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>
50 lines
1.4 KiB
Dart
50 lines
1.4 KiB
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
class OnboardingDraft {
|
|
const OnboardingDraft({
|
|
this.childName = '',
|
|
this.color = '#6C63FF',
|
|
this.pin = '',
|
|
this.pinConfirm = '',
|
|
this.importDefaultRules = true,
|
|
});
|
|
|
|
final String childName;
|
|
final String color;
|
|
final String pin;
|
|
final String pinConfirm;
|
|
final bool importDefaultRules;
|
|
|
|
OnboardingDraft copyWith({
|
|
String? childName,
|
|
String? color,
|
|
String? pin,
|
|
String? pinConfirm,
|
|
bool? importDefaultRules,
|
|
}) {
|
|
return OnboardingDraft(
|
|
childName: childName ?? this.childName,
|
|
color: color ?? this.color,
|
|
pin: pin ?? this.pin,
|
|
pinConfirm: pinConfirm ?? this.pinConfirm,
|
|
importDefaultRules: importDefaultRules ?? this.importDefaultRules,
|
|
);
|
|
}
|
|
}
|
|
|
|
class OnboardingDraftNotifier extends StateNotifier<OnboardingDraft> {
|
|
OnboardingDraftNotifier() : super(const OnboardingDraft());
|
|
|
|
void setChildName(String value) => state = state.copyWith(childName: value);
|
|
void setColor(String value) => state = state.copyWith(color: value);
|
|
void setPin(String value) => state = state.copyWith(pin: value);
|
|
void setPinConfirm(String value) => state = state.copyWith(pinConfirm: value);
|
|
void setImportDefaultRules(bool value) =>
|
|
state = state.copyWith(importDefaultRules: value);
|
|
}
|
|
|
|
final onboardingDraftProvider =
|
|
StateNotifierProvider<OnboardingDraftNotifier, OnboardingDraft>(
|
|
(ref) => OnboardingDraftNotifier(),
|
|
);
|