fix: clear season flow when starting Classic so tutorial/theme can't leak
- Add SeasonFlowNotifier.clear() to null out the flow state - Call clear() in HomeScreen's Classic button before startStage() - Broaden tutorial-end guard to next.phase != GamePhase.playing (covers stuck) - Add regression test: clear() resets flow to null Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -150,7 +150,7 @@ class _GameScreenState extends ConsumerState<GameScreen>
|
||||
if (prev?.phase != next.phase) {
|
||||
// A finished stage ends the tutorial; otherwise the overlay would sit
|
||||
// on top of the result card and leak into the next stage.
|
||||
if (next.phase == GamePhase.won || next.phase == GamePhase.lost) {
|
||||
if (next.phase != GamePhase.playing) {
|
||||
ref.read(tutorialProvider.notifier).skip();
|
||||
}
|
||||
if (next.phase == GamePhase.won) {
|
||||
|
||||
@@ -84,6 +84,7 @@ class HomeScreen extends ConsumerWidget {
|
||||
),
|
||||
onPressed: () {
|
||||
if (!(ModalRoute.of(context)?.isCurrent ?? true)) return;
|
||||
ref.read(seasonFlowProvider.notifier).clear();
|
||||
ref.read(gameSessionProvider.notifier).startStage(
|
||||
StageConfig.endless(
|
||||
seed: DateTime.now().millisecondsSinceEpoch,
|
||||
|
||||
Reference in New Issue
Block a user