mirror of
https://github.com/Iconica-Development/flutter_start.git
synced 2025-05-18 18:13:45 +02:00
feat: added after splash route
This commit is contained in:
parent
cdf53e9afa
commit
4f322cb4a3
4 changed files with 15 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
## 2.0.3
|
||||||
|
|
||||||
|
- Added after splashscreen route
|
||||||
|
|
||||||
## 2.0.2
|
## 2.0.2
|
||||||
|
|
||||||
- Added configuration options
|
- Added configuration options
|
||||||
|
|
|
@ -63,5 +63,5 @@ class StartUserStoryConfiguration {
|
||||||
final int minimumSplashScreenDuration;
|
final int minimumSplashScreenDuration;
|
||||||
|
|
||||||
/// The future that is awaited before the splash screen is closed.
|
/// The future that is awaited before the splash screen is closed.
|
||||||
final Future<void> Function(BuildContext context)? splashScreenFuture;
|
final Future<String?> Function(BuildContext context)? splashScreenFuture;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,10 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
var go = context.go;
|
var go = context.go;
|
||||||
var killSwitchIsActive = false;
|
var killSwitchIsActive = false;
|
||||||
var introductionSeen = false;
|
var introductionSeen = false;
|
||||||
Future<void> myFunction() async {
|
String? routeAfterSplash;
|
||||||
|
Future<void> splashLoadingMethod() async {
|
||||||
await Future.wait<void>(
|
await Future.wait<void>(
|
||||||
[
|
[
|
||||||
configuration.splashScreenFuture?.call(context) ??
|
|
||||||
Future.value(),
|
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
Duration.zero,
|
Duration.zero,
|
||||||
() async {
|
() async {
|
||||||
|
@ -40,6 +39,10 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
SharedPreferencesIntroductionDataProvider(),
|
SharedPreferencesIntroductionDataProvider(),
|
||||||
);
|
);
|
||||||
introductionSeen = !await introService.shouldShow();
|
introductionSeen = !await introService.shouldShow();
|
||||||
|
if (context.mounted)
|
||||||
|
routeAfterSplash = await configuration.splashScreenFuture
|
||||||
|
?.call(context) ??
|
||||||
|
configuration.homeScreenRoute;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
|
@ -56,21 +59,21 @@ List<GoRoute> getStartStoryRoutes(
|
||||||
if (!configuration.showIntroduction ||
|
if (!configuration.showIntroduction ||
|
||||||
(introductionSeen && !configuration.alwaysShowIntroduction)) {
|
(introductionSeen && !configuration.alwaysShowIntroduction)) {
|
||||||
return go(
|
return go(
|
||||||
configuration.homeScreenRoute ?? StartUserStoryRoutes.home,
|
routeAfterSplash ?? StartUserStoryRoutes.home,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return go(StartUserStoryRoutes.introduction);
|
return go(StartUserStoryRoutes.introduction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration.splashScreenBuilder == null) {
|
if (configuration.splashScreenBuilder == null) {
|
||||||
unawaited(myFunction());
|
unawaited(splashLoadingMethod());
|
||||||
}
|
}
|
||||||
return buildScreenWithoutTransition(
|
return buildScreenWithoutTransition(
|
||||||
context: context,
|
context: context,
|
||||||
state: state,
|
state: state,
|
||||||
child: configuration.splashScreenBuilder?.call(
|
child: configuration.splashScreenBuilder?.call(
|
||||||
context,
|
context,
|
||||||
() async => myFunction(),
|
() async => splashLoadingMethod(),
|
||||||
) ??
|
) ??
|
||||||
Scaffold(
|
Scaffold(
|
||||||
backgroundColor: configuration.splashScreenBackgroundColor,
|
backgroundColor: configuration.splashScreenBackgroundColor,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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."
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 2.0.2
|
version: 2.0.3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.2.5 <4.0.0"
|
sdk: ">=3.2.5 <4.0.0"
|
||||||
|
|
Loading…
Reference in a new issue