mirror of
https://github.com/Iconica-Development/flutter_start.git
synced 2025-05-18 18:13:45 +02:00
feat(navigator): add navigator widget to allow for app independent navigation
This commit is contained in:
parent
6f24e0521d
commit
0976083a9f
3 changed files with 20 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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<void> startNavigatorUserStory(
|
|||
StartUserStoryConfiguration configuration, {
|
||||
required void Function(BuildContext context) onComplete,
|
||||
}) 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(
|
||||
builder: (context) => _splashScreen(
|
||||
configuration,
|
||||
|
@ -59,8 +66,7 @@ Future<void> startNavigatorUserStory(
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
await Navigator.of(context).push(initialRoute);
|
||||
return initialRoute;
|
||||
}
|
||||
|
||||
Widget _splashScreen(
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue