diff --git a/CHANGELOG.md b/CHANGELOG.md index e67a7f2..1c2af92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ -## 4.2.1 +## 4.2.2 +- Added custom navigator in the root of the navigator user-story -* Updated flutter_introduction to 5.0.0 +## 4.2.1 +- Updated flutter_introduction to 5.0.0 ## 4.1.0 - Updated README diff --git a/lib/src/user_stories/flutter_start_userstory_navigator.dart b/lib/src/user_stories/flutter_start_userstory_navigator.dart index 3774db2..feee2a8 100644 --- a/lib/src/user_stories/flutter_start_userstory_navigator.dart +++ b/lib/src/user_stories/flutter_start_userstory_navigator.dart @@ -19,13 +19,11 @@ class NavigatorStartUserStory extends StatelessWidget { final void Function(BuildContext context) onComplete; @override - Widget build(BuildContext context) { - if (!configuration.showSplashScreen) { - return _introduction(configuration, context, onComplete); - } - - return _splashScreen(configuration, context, onComplete); - } + Widget build(BuildContext context) => Navigator( + onGenerateInitialRoutes: (_, __) => [ + _getInitialRoute(configuration, onComplete), + ], + ); } /// Enter the start user story with the Navigator 1.0 API. @@ -42,6 +40,15 @@ Future startNavigatorUserStory( StartUserStoryConfiguration configuration, { required void Function(BuildContext context) onComplete, }) async { + var initialRoute = _getInitialRoute(configuration, onComplete); + + await Navigator.of(context).push(initialRoute); +} + +MaterialPageRoute _getInitialRoute( + StartUserStoryConfiguration configuration, + void Function(BuildContext context) onComplete, +) { var initialRoute = MaterialPageRoute( builder: (context) => _splashScreen( configuration, @@ -59,8 +66,7 @@ Future startNavigatorUserStory( ), ); } - - await Navigator.of(context).push(initialRoute); + return initialRoute; } Widget _splashScreen( diff --git a/pubspec.yaml b/pubspec.yaml index 34fca36..4ff232f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_start description: "Flutter_start is a package that allows you to jumpstart your application with a splashScreen, introduction and a home." -version: 4.2.1 +version: 4.2.2 publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub