Merge pull request #12 from Iconica-Development/2.0.4

2.0.4
This commit is contained in:
Freek van de Ven 2024-02-15 15:40:10 +01:00 committed by GitHub
commit d7a13f731e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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 ## 2.0.3
- Added after splashscreen route - Added after splashscreen route

View file

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

View file

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

View file

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

View file

@ -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.3 version: 2.0.4
environment: environment:
sdk: ">=3.2.5 <4.0.0" sdk: ">=3.2.5 <4.0.0"