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
bb0c256401
commit
ee0c365ed2
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
|
## 4.1.0
|
||||||
- Updated README
|
- Updated README
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue