This commit is contained in:
mike doornenbal 2024-02-15 11:57:05 +01:00
parent e172704ac7
commit 851a98cc1a
5 changed files with 13 additions and 15 deletions

View file

@ -1,3 +1,7 @@
## 2.0.4
- Removed `AlwaysShowIntroduction` option, changed naming of `isKillSwitchActive` to `isAllowedToPassThrough`.
## 2.0.3
- Added after splashscreen route

View file

@ -13,7 +13,6 @@ class StartUserStoryConfiguration {
this.introductionFallbackScreen,
this.introductionScrollPhysics,
this.showIntroduction = true,
this.alwaysShowIntroduction = false,
this.useKillswitch = false,
this.minimumSplashScreenDuration = 3,
this.splashScreenFuture,
@ -47,9 +46,6 @@ class StartUserStoryConfiguration {
/// If the introduction should be shown.
final bool showIntroduction;
/// If this is true the introduction will always be shown.
final bool alwaysShowIntroduction;
/// If the killswitch is enabled this app can be remotely disabled.
final bool useKillswitch;

View file

@ -22,7 +22,7 @@ List<GoRoute> getStartStoryRoutes(
path: StartUserStoryRoutes.splashScreen,
pageBuilder: (context, state) {
var go = context.go;
var killSwitchIsActive = false;
var isAllowedToPassThrough = false;
var introductionSeen = false;
String? routeAfterSplash;
Future<void> splashLoadingMethod() async {
@ -32,7 +32,7 @@ List<GoRoute> getStartStoryRoutes(
Duration.zero,
() async {
if (configuration.useKillswitch)
killSwitchIsActive =
isAllowedToPassThrough =
await KillswitchService().isKillswitchActive();
var introService = configuration.introductionService ??
IntroductionService(
@ -54,10 +54,9 @@ List<GoRoute> getStartStoryRoutes(
],
);
if (configuration.useKillswitch && killSwitchIsActive) return;
if (configuration.useKillswitch && isAllowedToPassThrough) return;
if (!configuration.showIntroduction ||
(introductionSeen && !configuration.alwaysShowIntroduction)) {
if (!configuration.showIntroduction || introductionSeen) {
return go(
routeAfterSplash ?? StartUserStoryRoutes.home,
);

View file

@ -19,7 +19,7 @@ Widget _splashScreen(
BuildContext context,
) {
var navigator = Navigator.of(context);
var killSwitchIsActive = false;
var isAllowedToPassThrough = false;
var introductionSeen = false;
Future<void> myFunction() async {
await Future.wait<void>(
@ -29,7 +29,7 @@ Widget _splashScreen(
Duration.zero,
() async {
if (configuration.useKillswitch)
killSwitchIsActive =
isAllowedToPassThrough =
await KillswitchService().isKillswitchActive();
var introService = configuration.introductionService ??
IntroductionService(
@ -47,10 +47,9 @@ Widget _splashScreen(
],
);
if (configuration.useKillswitch && killSwitchIsActive) return;
if (configuration.useKillswitch && isAllowedToPassThrough) return;
if (!configuration.showIntroduction ||
(introductionSeen && !configuration.alwaysShowIntroduction)) {
if (!configuration.showIntroduction || introductionSeen) {
await navigator.pushReplacement(
MaterialPageRoute(
builder: (context) => _home(configuration, context),

View file

@ -1,7 +1,7 @@
name: flutter_start
description: "Flutter_start is a package that allows you to jumpstart your application with a splashScreen, introduction and a home."
publish_to: "none"
version: 2.0.3
version: 2.0.4
environment:
sdk: ">=3.2.5 <4.0.0"