341 lines
12 KiB
Dart
341 lines
12 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../core/i18n/app_locale.dart';
|
|
import '../../core/theme/tokens.dart';
|
|
|
|
/// 회원가입 약관 — Figma `179:24230`(미동의) · `179:24324`(전체 동의).
|
|
///
|
|
/// 필수 4항을 모두 체크해야 「완료」가 켜진다. 완료하면 동의한 항목 키([signupTermKeys] 중)를
|
|
/// 돌려준다 — 가입 모드([SimpleLoginScreen])는 `pop` 결과로, 온보딩은 [onAgreed] 로 받는다.
|
|
/// 서버(`fnSignupConsent`)가 같은 필수 목록을 다시 검사하고 항목별 동의 행을 남긴다.
|
|
///
|
|
/// 필수 항목은 Figma 의 서비스 · 위치기반 · 만 14세에 개인정보 처리방침을 더했다(10/3 통합회신
|
|
/// 3절 4 「이용약관 · 개인정보처리방침 문구 제공」). 구성은 해석 확인 요청 E-Q1 회신 대기다.
|
|
/// 약관 본문은 발주사 실서비스 문구를 받기 전까지 시안의 자리 표시 문구다 — 받으면 [_body] 와
|
|
/// [signupTermsVersion] 을 함께 바꾼다(동의 기록에 버전이 남는다).
|
|
class TermsScreen extends StatefulWidget {
|
|
const TermsScreen({
|
|
super.key,
|
|
this.onAgreed,
|
|
this.onBack,
|
|
this.initial = const {},
|
|
});
|
|
|
|
/// 처음부터 체크해 둘 항목 키 — 온보딩 ③ 에서 뒤로 왔을 때 이미 동의한 항목.
|
|
final Set<String> initial;
|
|
|
|
/// 온보딩 안에서 쓸 때 — 「완료」가 화면을 닫지 않고 이걸 부른다.
|
|
final ValueChanged<Set<String>>? onAgreed;
|
|
final VoidCallback? onBack;
|
|
|
|
@override
|
|
State<TermsScreen> createState() => _TermsScreenState();
|
|
}
|
|
|
|
/// 동의 기록에 남는 약관 버전. 🟡 임시 — 본문이 자리 표시 문구인 동안은 `draft` 다.
|
|
const signupTermsVersion = 'draft-1';
|
|
|
|
/// 서버 `SIGNUP_REQUIRED_TERMS` + 선택 `marketing` 과 같은 키.
|
|
List<String> get signupTermKeys => [for (final t in _Term.values) t.name];
|
|
|
|
enum _Term {
|
|
service(required: true, body: true),
|
|
privacy(required: true, body: true),
|
|
location(required: true, body: true),
|
|
age(required: true, body: false),
|
|
marketing(required: false, body: true);
|
|
|
|
const _Term({required this.required, required this.body});
|
|
|
|
final bool required;
|
|
final bool body;
|
|
|
|
String label(AppLocalizations l10n) => switch (this) {
|
|
service => l10n.termsService,
|
|
privacy => l10n.termsPrivacy,
|
|
location => l10n.termsLocation,
|
|
age => l10n.termsAge,
|
|
marketing => l10n.termsMarketing,
|
|
};
|
|
}
|
|
|
|
const _body =
|
|
'FANUZU 서비스 이용약관\n\n제1조 (적용범위)\n서비스 이용약관에 대한 더미 텍스트 입니다.\n'
|
|
'추후 작성해주시기 바랍니다. 서비스 이용약관에 대한 더미 텍스트 입니다.';
|
|
|
|
const _stroke = Color(0xFF545454);
|
|
|
|
class _TermsScreenState extends State<TermsScreen> {
|
|
late final _agreed = <_Term>{
|
|
for (final t in _Term.values)
|
|
if (widget.initial.contains(t.name)) t,
|
|
};
|
|
|
|
bool get _all => _agreed.length == _Term.values.length;
|
|
bool get _ready =>
|
|
_Term.values.where((t) => t.required).every(_agreed.contains);
|
|
|
|
void _done() {
|
|
final agreed = {for (final t in _agreed) t.name};
|
|
final cb = widget.onAgreed;
|
|
cb != null ? cb(agreed) : Navigator.of(context).pop(agreed);
|
|
}
|
|
|
|
void _toggle(_Term t) =>
|
|
setState(() => _agreed.contains(t) ? _agreed.remove(t) : _agreed.add(t));
|
|
|
|
Widget _termsButtons(BuildContext context) {
|
|
final shape = RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(AppRadius.sm),
|
|
);
|
|
return Row(
|
|
children: [
|
|
Expanded(
|
|
child: FilledButton(
|
|
onPressed: widget.onBack ?? () => Navigator.of(context).pop(),
|
|
style: FilledButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(56),
|
|
shape: shape,
|
|
side: const BorderSide(color: _stroke),
|
|
backgroundColor: Colors.black,
|
|
foregroundColor: AppColors.onCosmic,
|
|
),
|
|
child: Text(context.l10n.commonPrev),
|
|
),
|
|
),
|
|
const SizedBox(width: 10),
|
|
Expanded(
|
|
child: FilledButton(
|
|
onPressed: _ready ? _done : null,
|
|
style: FilledButton.styleFrom(
|
|
minimumSize: const Size.fromHeight(56),
|
|
shape: shape,
|
|
side: const BorderSide(color: _stroke),
|
|
backgroundColor: AppColors.cosmicAccent,
|
|
foregroundColor: AppColors.onCosmicAccent,
|
|
disabledBackgroundColor: const Color(0xFF333333),
|
|
disabledForegroundColor: const Color(0xFF777777),
|
|
),
|
|
child: Text(context.l10n.commonDone),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(context.l10n.termsTitle)),
|
|
// Figma `179:24230` — 「이전 · 완료」는 목록 끝이 아니라 화면 하단 고정(56 높이 · 간격 10 · 아래 16).
|
|
// 시스템 내비게이션 바 위로 올린다(SafeArea) — 10/6 실기기에서 첫 탭이 바에 먹혔다.
|
|
bottomNavigationBar: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(AppSpace.s4),
|
|
child: _termsButtons(context),
|
|
),
|
|
),
|
|
body: ListView(
|
|
padding: const EdgeInsets.all(AppSpace.s4),
|
|
children: [
|
|
_Box(
|
|
child: _CheckRow(
|
|
label: context.l10n.termsAgreeAll,
|
|
checked: _all,
|
|
size: 16,
|
|
onTap: () => setState(
|
|
() => _all ? _agreed.clear() : _agreed.addAll(_Term.values),
|
|
),
|
|
),
|
|
),
|
|
for (final t in _Term.values) ...[
|
|
const SizedBox(height: AppSpace.s3),
|
|
_Box(
|
|
child: t.body
|
|
? Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Container(
|
|
// 시안 획은 안쪽이다 — decoration 이면 획 두께만큼 높이가 는다.
|
|
foregroundDecoration: const BoxDecoration(
|
|
border: Border(bottom: BorderSide(color: _stroke)),
|
|
),
|
|
child: _CheckRow(
|
|
label: t.label(context.l10n),
|
|
checked: _agreed.contains(t),
|
|
onTap: () => _toggle(t),
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: AppSpace.s4),
|
|
child: SizedBox(
|
|
height: 80,
|
|
child: ClipRect(
|
|
child: Text(
|
|
_body,
|
|
overflow: TextOverflow.clip,
|
|
style: TextStyle(
|
|
fontFamily: AppFonts.display,
|
|
fontFamilyFallback: [AppFonts.body],
|
|
fontSize: 12,
|
|
height: 1.36,
|
|
letterSpacing: -0.3,
|
|
color: AppColors.onCosmic,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
: _CheckRow(
|
|
label: t.label(context.l10n),
|
|
checked: _agreed.contains(t),
|
|
onTap: () => _toggle(t),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 약관 칸 — #545454 획 · 모서리 8 · 좌우 16.
|
|
class _Box extends StatelessWidget {
|
|
const _Box({required this.child});
|
|
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: AppSpace.s4),
|
|
foregroundDecoration: BoxDecoration(
|
|
border: Border.all(color: _stroke),
|
|
borderRadius: BorderRadius.circular(AppRadius.sm),
|
|
),
|
|
child: child,
|
|
);
|
|
}
|
|
|
|
/// 체크 행 — circle-check 20 · 간격 16 · ABeeZee. 미동의는 #767676, 동의는 핑크.
|
|
class _CheckRow extends StatelessWidget {
|
|
const _CheckRow({
|
|
required this.label,
|
|
required this.checked,
|
|
required this.onTap,
|
|
this.size = 14,
|
|
});
|
|
|
|
final String label;
|
|
final bool checked;
|
|
final VoidCallback onTap;
|
|
final double size;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => InkWell(
|
|
onTap: onTap,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: AppSpace.s4),
|
|
child: Row(
|
|
children: [
|
|
ImageIcon(
|
|
const AssetImage('assets/icons/circle_check.png'),
|
|
size: 20,
|
|
color: checked ? AppColors.cosmicAccent : AppColors.onCosmicMuted,
|
|
),
|
|
const SizedBox(width: AppSpace.s4),
|
|
Expanded(
|
|
child: Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontFamily: AppFonts.display,
|
|
fontFamilyFallback: const [AppFonts.body],
|
|
fontSize: size,
|
|
height: size == 16 ? 24 / 16 : 20 / 14,
|
|
color: AppColors.onCosmic,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// 회원가입 완료 — Figma `182:29344`. 가입 직후 라우터 redirect 가 한 번 띄우고
|
|
/// ([AuthRepository.justSignedUp]), 「시작」은 [onStart] 로 셸에 들어간다.
|
|
class SignupCompleteScreen extends StatelessWidget {
|
|
const SignupCompleteScreen({super.key, this.onStart});
|
|
|
|
final VoidCallback? onStart;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Expanded(
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(20),
|
|
child: SizedBox.square(
|
|
dimension: 120,
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: AppColors.cosmicAccent,
|
|
shape: BoxShape.circle,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: AppSpace.s6),
|
|
Text(
|
|
context.l10n.signupDoneTitle,
|
|
style: TextStyle(
|
|
fontFamily: AppFonts.body,
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w600,
|
|
height: 1,
|
|
color: AppColors.onCosmic,
|
|
),
|
|
),
|
|
const SizedBox(height: AppSpace.s3),
|
|
Text(
|
|
context.l10n.signupDoneBody,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontFamily: AppFonts.display,
|
|
fontFamilyFallback: const [AppFonts.body],
|
|
fontSize: 14,
|
|
height: 24 / 14,
|
|
color: const Color(0xFFCDCDCD),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: AppSpace.s4),
|
|
child: FilledButton(
|
|
onPressed: onStart ?? () => Navigator.of(context).maybePop(),
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: AppColors.cosmicAccent,
|
|
foregroundColor: AppColors.onCosmicAccent,
|
|
),
|
|
child: Text(context.l10n.commonStart),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|