fix: bug with showing introduction

This commit is contained in:
mike doornenbal 2024-02-09 10:49:12 +01:00
parent 66ef9af8bb
commit 223a343a56
4 changed files with 3 additions and 16 deletions

View file

@ -24,13 +24,6 @@ class Home extends StatelessWidget {
startNavigatorUserStory(config, context); startNavigatorUserStory(config, context);
} }
final _router = GoRouter(
initialLocation: '/splashScreen',
routes: [
...getStartRoutes(),
],
);
List<GoRoute> getStartRoutes() => getStartStoryRoutes( List<GoRoute> getStartRoutes() => getStartStoryRoutes(
config, config,
); );
@ -40,7 +33,7 @@ StartUserStoryConfiguration config = StartUserStoryConfiguration(
ExampleIntroductionDataProvider(), ExampleIntroductionDataProvider(),
), ),
useKillswitch: true, useKillswitch: true,
// showIntroduction: false, showIntroduction: true,
splashScreenBuilder: (context, onFinish) => SplashScreen( splashScreenBuilder: (context, onFinish) => SplashScreen(
onFinish: onFinish, onFinish: onFinish,
), ),

View file

@ -13,7 +13,6 @@ class StartUserStoryConfiguration {
this.introductionFallbackScreen, this.introductionFallbackScreen,
this.introductionScrollPhysics, this.introductionScrollPhysics,
this.showIntroduction = true, this.showIntroduction = true,
this.alwaysShowIntroduction = false,
this.useKillswitch = false, this.useKillswitch = false,
this.minimumSplashScreenDuration = 3, this.minimumSplashScreenDuration = 3,
this.splashScreenFuture, this.splashScreenFuture,
@ -47,9 +46,6 @@ class StartUserStoryConfiguration {
/// If the introduction should be shown. /// If the introduction should be shown.
final bool showIntroduction; final bool showIntroduction;
/// If this is true the introduction will always be shown.
final bool alwaysShowIntroduction;
/// If the killswitch is enabled this app can be remotely disabled. /// If the killswitch is enabled this app can be remotely disabled.
final bool useKillswitch; final bool useKillswitch;

View file

@ -53,8 +53,7 @@ List<GoRoute> getStartStoryRoutes(
if (configuration.useKillswitch && !isAllowedToPassThrough) return; if (configuration.useKillswitch && !isAllowedToPassThrough) return;
if (!configuration.showIntroduction || if (!configuration.showIntroduction || introductionSeen) {
(introductionSeen && !configuration.alwaysShowIntroduction)) {
return go( return go(
configuration.homeScreenRoute ?? StartUserStoryRoutes.home, configuration.homeScreenRoute ?? StartUserStoryRoutes.home,
); );

View file

@ -49,8 +49,7 @@ Widget _splashScreen(
if (configuration.useKillswitch && !isAllowedToPassThrough) return; if (configuration.useKillswitch && !isAllowedToPassThrough) return;
if (!configuration.showIntroduction || if (!configuration.showIntroduction || introductionSeen) {
(introductionSeen && !configuration.alwaysShowIntroduction)) {
await navigator.pushReplacement( await navigator.pushReplacement(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => _home(configuration, context), builder: (context) => _home(configuration, context),