From 944d82e0127bbce1518a7ecab85e865503a7e127 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Wed, 8 Nov 2023 10:14:10 +0200 Subject: [PATCH] Fix last test --- packages/ubuntu_init/lib/src/init_wizard.dart | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/ubuntu_init/lib/src/init_wizard.dart b/packages/ubuntu_init/lib/src/init_wizard.dart index 6a377022d..3766625e0 100644 --- a/packages/ubuntu_init/lib/src/init_wizard.dart +++ b/packages/ubuntu_init/lib/src/init_wizard.dart @@ -114,6 +114,27 @@ class InitWizard extends ConsumerWidget { builder: (_) => const PrivacyPage(), onLoad: (_) => PrivacyPage.load(ref), ), + InitRoutes.store: () { + bool shownPage = false; + return WizardRoute( + userData: const WizardRouteData(hasNext: false), + builder: (_) => const StorePage(), + onLoad: (_) { + shownPage = true; + return StorePage.load(ref); + }, + onNext: (_) async { + if (shownPage) { + final window = YaruWindow.of(context); + await _onDone?.call(); + await window.close(); + return InitRoutes.initial; + } else { + return null; + } + }, + ); + }(), InitRoutes.launchsession: () { bool shownPage = false; return WizardRoute( @@ -136,17 +157,6 @@ class InitWizard extends ConsumerWidget { } }); }(), - InitRoutes.store: WizardRoute( - userData: const WizardRouteData(hasNext: false), - builder: (_) => const StorePage(), - onLoad: (_) => StorePage.load(ref), - onNext: (_) async { - final window = YaruWindow.of(context); - await _onDone?.call(); - await window.close(); - return InitRoutes.initial; - }, - ), }, userData: WizardData(totalSteps: InitStep.values.length), predicate: (route) => switch (route) {