Phase 1 du MVP : schéma SQLite porté depuis le prototype web, seed des règles/récompenses, flux d'onboarding en 4 étapes et écran d'accueil minimal. Co-authored-by: Cursor <cursoragent@cursor.com>
89 lines
2.8 KiB
Dart
89 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/theme/app_theme.dart';
|
|
|
|
class OnboardingScaffold extends StatelessWidget {
|
|
const OnboardingScaffold({
|
|
super.key,
|
|
required this.title,
|
|
required this.subtitle,
|
|
required this.child,
|
|
this.bottom,
|
|
this.step,
|
|
this.totalSteps = 4,
|
|
});
|
|
|
|
final String title;
|
|
final String subtitle;
|
|
final Widget child;
|
|
final Widget? bottom;
|
|
final int? step;
|
|
final int totalSteps;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DecoratedBox(
|
|
decoration: const BoxDecoration(gradient: AppTheme.primaryGradient),
|
|
child: Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
body: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
if (step != null) ...[
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
children: List.generate(totalSteps, (index) {
|
|
final active = index < step!;
|
|
return Expanded(
|
|
child: Container(
|
|
height: 4,
|
|
margin: EdgeInsets.only(
|
|
right: index < totalSteps - 1 ? 6 : 0,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: active
|
|
? Colors.white
|
|
: Colors.white.withValues(alpha: 0.35),
|
|
borderRadius: BorderRadius.circular(2),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
],
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
subtitle,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
|
color: Colors.white.withValues(alpha: 0.9),
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Expanded(child: child),
|
|
if (bottom != null) ...[
|
|
const SizedBox(height: 16),
|
|
bottom!,
|
|
const SizedBox(height: 16),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|