feat(navigator): add navigator widget to allow for app independent navigation

This commit is contained in:
Joey Boerwinkel 2025-03-17 12:45:34 +01:00
parent bb0c256401
commit ee0c365ed2
3 changed files with 20 additions and 12 deletions

View file

@ -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 ## 4.1.0
- Updated README - Updated README

View file

@ -19,13 +19,11 @@ class NavigatorStartUserStory extends StatelessWidget {
final void Function(BuildContext context) onComplete; final void Function(BuildContext context) onComplete;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) => Navigator(
if (!configuration.showSplashScreen) { onGenerateInitialRoutes: (_, __) => [
return _introduction(configuration, context, onComplete); _getInitialRoute(configuration, onComplete),
} ],
);
return _splashScreen(configuration, context, onComplete);
}
} }
/// Enter the start user story with the Navigator 1.0 API. /// Enter the start user story with the Navigator 1.0 API.
@ -42,6 +40,15 @@ Future<void> startNavigatorUserStory(
StartUserStoryConfiguration configuration, { StartUserStoryConfiguration configuration, {
required void Function(BuildContext context) onComplete, required void Function(BuildContext context) onComplete,
}) async { }) async {
var initialRoute = _getInitialRoute(configuration, onComplete);
await Navigator.of(context).push(initialRoute);
}
MaterialPageRoute<dynamic> _getInitialRoute(
StartUserStoryConfiguration configuration,
void Function(BuildContext context) onComplete,
) {
var initialRoute = MaterialPageRoute( var initialRoute = MaterialPageRoute(
builder: (context) => _splashScreen( builder: (context) => _splashScreen(
configuration, configuration,
@ -59,8 +66,7 @@ Future<void> startNavigatorUserStory(
), ),
); );
} }
return initialRoute;
await Navigator.of(context).push(initialRoute);
} }
Widget _splashScreen( Widget _splashScreen(

View file

@ -1,6 +1,6 @@
name: flutter_start name: flutter_start
description: "Flutter_start is a package that allows you to jumpstart your application with a splashScreen, introduction and a home." 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 publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub