Merge pull request #13 from Iconica-Development/feat/can-pop-introduction

feat(introduction): add popscope for introduction screen
This commit is contained in:
Freek van de Ven 2024-02-28 10:57:28 +01:00 committed by GitHub
commit ff0df4e1b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 10 deletions

View file

@ -1,3 +1,7 @@
## 2.0.5
- Added canPopFromIntroduction to enable/disable popping from introduction screens
## 2.0.4 ## 2.0.4
- Removed `AlwaysShowIntroduction` option, changed naming of `isKillSwitchActive` to `isAllowedToPassThrough`. - Removed `AlwaysShowIntroduction` option, changed naming of `isKillSwitchActive` to `isAllowedToPassThrough`.

View file

@ -18,6 +18,7 @@ class StartUserStoryConfiguration {
this.splashScreenFuture, this.splashScreenFuture,
this.splashScreenCenterWidget, this.splashScreenCenterWidget,
this.splashScreenBackgroundColor, this.splashScreenBackgroundColor,
this.canPopFromIntroduction = true,
}); });
/// You can use this to build your own splash screen. /// You can use this to build your own splash screen.
@ -60,4 +61,7 @@ class StartUserStoryConfiguration {
/// The future that is awaited before the splash screen is closed. /// The future that is awaited before the splash screen is closed.
final Future<String?> Function(BuildContext context)? splashScreenFuture; final Future<String?> Function(BuildContext context)? splashScreenFuture;
/// Allow popping from introduction, defaults to true
final bool canPopFromIntroduction;
} }

View file

@ -103,16 +103,20 @@ List<GoRoute> getStartStoryRoutes(
physics: configuration.introductionScrollPhysics, physics: configuration.introductionScrollPhysics,
child: configuration.introductionFallbackScreen, child: configuration.introductionFallbackScreen,
); );
return buildScreenWithoutTransition( return buildScreenWithoutTransition(
context: context, context: context,
state: state, state: state,
child: configuration.introductionBuilder?.call( child: PopScope(
context, canPop: configuration.canPopFromIntroduction,
introduction, child: configuration.introductionBuilder?.call(
) ?? context,
Scaffold( introduction,
body: introduction, ) ??
), Scaffold(
body: introduction,
),
),
); );
}, },
), ),

View file

@ -93,8 +93,11 @@ Widget _introduction(
physics: configuration.introductionScrollPhysics, physics: configuration.introductionScrollPhysics,
child: configuration.introductionFallbackScreen, child: configuration.introductionFallbackScreen,
); );
return Scaffold( return PopScope(
body: introduction, canPop: configuration.canPopFromIntroduction,
child: Scaffold(
body: introduction,
),
); );
} }

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.4 version: 2.0.5
environment: environment:
sdk: ">=3.2.5 <4.0.0" sdk: ">=3.2.5 <4.0.0"