redesign: duolingo-pattern onboarding, no gradient, pressable button

- Nunito font replacing Plus Jakarta Sans
- SButton: Stack-based 3D pressable (dark shadow layer + top layer translates on press)
- SCard: flat border-based selection, no shadows
- SProgressBar: 4px thin bar, animated fill
- All screens: white bg, no gradients
- Duolingo layout: illustration top zone, content below, sticky button
This commit is contained in:
mav
2026-05-28 16:34:04 +02:00
parent 30cee5a486
commit 6311088256
9 changed files with 1168 additions and 638 deletions

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:google_fonts/google_fonts.dart';
import '../theme.dart';
import '../widgets/primary_button.dart';
import '../widgets/s_button.dart';
import 'quiz/quiz_flow.dart';
class ResultScreen extends StatefulWidget {
@@ -19,180 +18,196 @@ class _ResultScreenState extends State<ResultScreen> {
@override
void initState() {
super.initState();
Future.delayed(const Duration(milliseconds: 1800), () {
Future.delayed(const Duration(milliseconds: 2000), () {
if (mounted) setState(() => _revealed = true);
});
}
String get _firstName => widget.data.name.split(' ').first;
String get _name => widget.data.name.split(' ').first;
@override
Widget build(BuildContext context) {
return Scaffold(
body: _revealed ? _resultView() : _analyzingView(),
backgroundColor: SColors.bgSurface,
body: _revealed ? _resultView(context) : _analyzingView(),
);
}
// ── Analysing screen ──────────────────────────────────────────────────────
Widget _analyzingView() {
return Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF3D32A8), Color(0xFF5B4FCF), Color(0xFF8B5CF6)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
strokeWidth: 3,
)
.animate(onPlay: (c) => c.repeat())
.rotate(duration: 1.seconds),
const SizedBox(height: 28),
Text(
'Analysing your skin...',
style: GoogleFonts.plusJakartaSans(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white,
),
).animate(onPlay: (c) => c.repeat(reverse: true))
.fadeIn(duration: 800.ms),
const SizedBox(height: 8),
Text(
'Building your personalised routine',
style: GoogleFonts.plusJakartaSans(
fontSize: 14,
color: Colors.white.withAlpha(180),
),
return SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Pulsing Shaynee avatar
Image.asset('assets/images/shaynee_avatar.png', height: 120)
.animate(onPlay: (c) => c.repeat(reverse: true))
.scaleXY(begin: 0.95, end: 1.05, duration: 900.ms, curve: Curves.easeInOut),
const SizedBox(height: 32),
// Spinner (plain, no color)
const SizedBox(
width: 32,
height: 32,
child: CircularProgressIndicator(
strokeWidth: 2.5,
valueColor: AlwaysStoppedAnimation<Color>(SColors.primary),
),
],
),
),
const SizedBox(height: 20),
Text(
'Analysing your skin...',
style: SText.title(SColors.textHead),
),
const SizedBox(height: 8),
Text(
'Building your personalised routine',
style: SText.subtitle(SColors.textSub),
),
],
),
),
);
}
Widget _resultView() {
return Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF3D32A8), Color(0xFF5B4FCF), Color(0xFF8B5CF6)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
const SizedBox(height: 24),
Image.asset(
'assets/images/shaynee_hero.png',
height: 180,
fit: BoxFit.contain,
)
.animate()
.fadeIn(duration: 700.ms)
.slideY(begin: 0.15, end: 0, duration: 700.ms, curve: Curves.easeOut),
const SizedBox(height: 20),
Text(
'Your skin report\nis ready, $_firstName! ✨',
textAlign: TextAlign.center,
style: GoogleFonts.plusJakartaSans(
fontSize: 28,
fontWeight: FontWeight.w800,
color: Colors.white,
height: 1.2,
),
)
.animate()
.fadeIn(duration: 600.ms, delay: 200.ms),
const SizedBox(height: 28),
_reportCard()
.animate()
.fadeIn(duration: 600.ms, delay: 400.ms)
.slideY(begin: 0.1, end: 0, duration: 600.ms),
const SizedBox(height: 20),
_routinePreview()
.animate()
.fadeIn(duration: 600.ms, delay: 600.ms),
const SizedBox(height: 28),
PrimaryButton(
label: 'Start my routine',
icon: Icons.arrow_forward_rounded,
onTap: () {},
)
.animate()
.fadeIn(duration: 400.ms, delay: 800.ms),
const SizedBox(height: 32),
],
),
),
),
);
}
// ── Result reveal screen ──────────────────────────────────────────────────
Widget _reportCard() {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white.withAlpha(20),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.white.withAlpha(40)),
),
Widget _resultView(BuildContext context) {
return SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Your skin profile',
style: GoogleFonts.plusJakartaSans(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white.withAlpha(160),
letterSpacing: 0.8,
// Mascot zone (top 35%) — KEY MOMENT
Expanded(
flex: 35,
child: Container(
color: SColors.primaryLight,
width: double.infinity,
child: Center(
child: Image.asset(
'assets/images/shaynee_hero.png',
fit: BoxFit.contain,
)
.animate()
.fadeIn(duration: 600.ms)
.slideY(begin: 0.08, end: 0, duration: 600.ms, curve: Curves.easeOut),
),
),
),
// Content zone (bottom 65%)
Expanded(
flex: 65,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 20),
Text(
'Your skin report is\nready, $_name! ✨',
style: SText.headline2(SColors.textHead),
)
.animate()
.fadeIn(duration: 500.ms, delay: 200.ms),
const SizedBox(height: 6),
Text(
'Based on your answers, here\'s what we recommend.',
style: SText.subtitle(SColors.textSub),
)
.animate()
.fadeIn(duration: 500.ms, delay: 300.ms),
const SizedBox(height: 20),
// Skin profile card
_profileCard()
.animate()
.fadeIn(duration: 500.ms, delay: 400.ms)
.slideY(begin: 0.05, end: 0),
const SizedBox(height: 12),
// Routine preview card
_routineCard()
.animate()
.fadeIn(duration: 500.ms, delay: 550.ms)
.slideY(begin: 0.05, end: 0),
const SizedBox(height: 24),
// CTA
SButton(
label: 'START MY ROUTINE',
onTap: () {},
)
.animate()
.fadeIn(duration: 400.ms, delay: 700.ms),
const SizedBox(height: 12),
// Skip link (plain text, no button)
Center(
child: GestureDetector(
onTap: () {},
child: Text(
'Save my results — create account',
style: SText.caption(SColors.textSub),
),
),
)
.animate()
.fadeIn(duration: 400.ms, delay: 800.ms),
const SizedBox(height: 24),
],
),
),
),
const SizedBox(height: 14),
_reportRow('Skin type', widget.data.skinType),
_reportRow('Age range', widget.data.age),
_reportRow('Concerns', widget.data.concerns.join(', ')),
_reportRow('Main goal', widget.data.goal),
],
),
);
}
Widget _reportRow(String label, String value) {
if (value.isEmpty) return const SizedBox.shrink();
Widget _profileCard() {
final rows = [
('Skin type', widget.data.skinType),
('Age range', widget.data.age),
('Concerns', widget.data.concerns.join(', ')),
('Main goal', widget.data.goal),
];
return Container(
padding: const EdgeInsets.all(18),
decoration: BoxDecoration(
color: SColors.bgSurface,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: SColors.borderLight, width: 1.5),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'YOUR SKIN PROFILE',
style: SText.caption(SColors.textSub)
.copyWith(fontWeight: FontWeight.w700, letterSpacing: 0.8),
),
const SizedBox(height: 14),
...rows
.where((r) => r.$2.isNotEmpty)
.map((r) => _profileRow(r.$1, r.$2)),
],
),
);
}
Widget _profileRow(String label, String value) {
return Padding(
padding: const EdgeInsets.only(bottom: 10),
padding: const EdgeInsets.only(bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: GoogleFonts.plusJakartaSans(
fontSize: 13,
color: Colors.white.withAlpha(160),
),
),
const SizedBox(width: 12),
Expanded(
Text(label, style: SText.body(SColors.textSub)),
const Spacer(),
Flexible(
child: Text(
value,
textAlign: TextAlign.end,
style: GoogleFonts.plusJakartaSans(
fontSize: 13,
fontWeight: FontWeight.w600,
color: Colors.white,
),
style: SText.body(SColors.textHead).copyWith(fontWeight: FontWeight.w700),
),
),
],
@@ -200,30 +215,26 @@ class _ResultScreenState extends State<ResultScreen> {
);
}
Widget _routinePreview() {
Widget _routineCard() {
const steps = [
('🌅', 'Morning', 'Cleanser Vitamin C SPF 50'),
('🌙', 'Evening', 'Cleanser Retinol Moisturiser'),
('🌅', 'Morning', 'Cleanser · Vitamin C · SPF 50'),
('🌙', 'Evening', 'Cleanser · Retinol · Moisturiser'),
('', 'Weekly', 'Exfoliant + Hydrating mask'),
];
return Container(
padding: const EdgeInsets.all(20),
padding: const EdgeInsets.all(18),
decoration: BoxDecoration(
color: Colors.white.withAlpha(20),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.white.withAlpha(40)),
color: SColors.bgSurface,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: SColors.borderLight, width: 1.5),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Your routine preview',
style: GoogleFonts.plusJakartaSans(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white.withAlpha(160),
letterSpacing: 0.8,
),
'YOUR ROUTINE PREVIEW',
style: SText.caption(SColors.textSub)
.copyWith(fontWeight: FontWeight.w700, letterSpacing: 0.8),
),
const SizedBox(height: 14),
...steps.map((s) => Padding(
@@ -236,21 +247,10 @@ class _ResultScreenState extends State<ResultScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
s.$2,
style: GoogleFonts.plusJakartaSans(
fontSize: 13,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
Text(
s.$3,
style: GoogleFonts.plusJakartaSans(
fontSize: 12,
color: Colors.white.withAlpha(160),
),
),
Text(s.$2,
style: SText.cardLabel(SColors.textHead)),
const SizedBox(height: 2),
Text(s.$3, style: SText.cardSub(SColors.textSub)),
],
),
],