Full quiz flow s01-s20: splash, intro, value prop, social proof, name/skin-type/age/concerns/goal quiz with insights, analysing loader, result with skin score, AM/PM routines, ingredient science, signup, welcome. Duolingo-style design: flat cards, pressable SButton (Stack trick), 4px progress bar, mascot moods (wave/think/analyze/celebrate), confetti on result+welcome, personalized content throughout.
92 lines
3.6 KiB
Dart
92 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_animate/flutter_animate.dart';
|
|
import '../../theme.dart';
|
|
import '../../widgets/s_card.dart';
|
|
import '../../widgets/s_button.dart';
|
|
import '../../widgets/s_progress_bar.dart';
|
|
import '../../model/quiz_state.dart';
|
|
import '../../router.dart';
|
|
import 's12_almost_there.dart';
|
|
import '_quiz_nav.dart';
|
|
|
|
class GoalScreen extends StatefulWidget {
|
|
final QuizState state;
|
|
const GoalScreen({super.key, required this.state});
|
|
@override
|
|
State<GoalScreen> createState() => _State();
|
|
}
|
|
|
|
class _State extends State<GoalScreen> {
|
|
String _selected = '';
|
|
|
|
static const _opts = [
|
|
(Icons.auto_awesome_rounded, 'Healthy glow', 'Radiant, dewy, lit-from-within'),
|
|
(Icons.shield_rounded, 'Clear skin', 'Blemish-free, smooth texture'),
|
|
(Icons.access_time_rounded, 'Slow aging', 'Firm, youthful, preventive'),
|
|
(Icons.palette_rounded, 'Even tone', 'Balanced, bright complexion'),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: SColors.bgSurface,
|
|
body: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
QuizNav(step: 5, total: 7, onBack: () => Navigator.of(context).pop()),
|
|
const SizedBox(height: 10),
|
|
Padding(padding: const EdgeInsets.symmetric(horizontal: 16), child: SProgressBar(value: 5 / 7)),
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.fromLTRB(16, 24, 16, 0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Your main\nskin goal?', style: SText.headline2(SColors.textHead))
|
|
.animate().fadeIn(duration: 350.ms),
|
|
const SizedBox(height: 6),
|
|
Text("We'll build your entire plan around this.", style: SText.subtitle(SColors.textSub))
|
|
.animate().fadeIn(duration: 350.ms, delay: 80.ms),
|
|
const SizedBox(height: 20),
|
|
],
|
|
),
|
|
),
|
|
..._opts.asMap().entries.map((e) {
|
|
final i = e.key; final (icon, label, sub) = e.value;
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: SCard(
|
|
icon: icon, label: label, sub: sub,
|
|
isSelected: _selected == label,
|
|
onTap: () => setState(() => _selected = label),
|
|
).animate().fadeIn(duration: 280.ms, delay: (100 + i * 55).ms)
|
|
.slideX(begin: 0.03, end: 0, duration: 280.ms),
|
|
);
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 20),
|
|
child: SButton(
|
|
label: 'CONTINUE',
|
|
enabled: _selected.isNotEmpty,
|
|
onTap: _selected.isNotEmpty ? () {
|
|
widget.state.goal = _selected;
|
|
Navigator.of(context).push(slideRoute(AlmostThereScreen(state: widget.state)));
|
|
} : null,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|