mirror of
https://github.com/Iconica-Development/flutter_start.git
synced 2025-05-18 18:13:45 +02:00
fix: killswitch
This commit is contained in:
parent
ebe86cf934
commit
66ef9af8bb
3 changed files with 30 additions and 6 deletions
|
@ -24,11 +24,22 @@ class Home extends StatelessWidget {
|
|||
startNavigatorUserStory(config, context);
|
||||
}
|
||||
|
||||
final _router = GoRouter(
|
||||
initialLocation: '/splashScreen',
|
||||
routes: [
|
||||
...getStartRoutes(),
|
||||
],
|
||||
);
|
||||
|
||||
List<GoRoute> getStartRoutes() => getStartStoryRoutes(
|
||||
config,
|
||||
);
|
||||
|
||||
StartUserStoryConfiguration config = StartUserStoryConfiguration(
|
||||
introductionService: IntroductionService(
|
||||
ExampleIntroductionDataProvider(),
|
||||
),
|
||||
useKillswitch: true,
|
||||
// showIntroduction: false,
|
||||
splashScreenBuilder: (context, onFinish) => SplashScreen(
|
||||
onFinish: onFinish,
|
||||
|
|
|
@ -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;
|
||||
Future<void> myFunction() async {
|
||||
await Future.wait<void>(
|
||||
|
@ -33,7 +33,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
Duration.zero,
|
||||
() async {
|
||||
if (configuration.useKillswitch)
|
||||
killSwitchIsActive =
|
||||
isAllowedToPassThrough =
|
||||
await KillswitchService().isKillswitchActive();
|
||||
var introService = configuration.introductionService ??
|
||||
IntroductionService(
|
||||
|
@ -51,7 +51,7 @@ List<GoRoute> getStartStoryRoutes(
|
|||
],
|
||||
);
|
||||
|
||||
if (configuration.useKillswitch && killSwitchIsActive) return;
|
||||
if (configuration.useKillswitch && !isAllowedToPassThrough) return;
|
||||
|
||||
if (!configuration.showIntroduction ||
|
||||
(introductionSeen && !configuration.alwaysShowIntroduction)) {
|
||||
|
@ -114,4 +114,17 @@ List<GoRoute> getStartStoryRoutes(
|
|||
);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: StartUserStoryRoutes.home,
|
||||
pageBuilder: (context, state) {
|
||||
var home = configuration.homeEntry;
|
||||
return buildScreenWithoutTransition(
|
||||
context: context,
|
||||
state: state,
|
||||
child: Scaffold(
|
||||
body: home,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
|
|
|
@ -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,7 +47,7 @@ Widget _splashScreen(
|
|||
],
|
||||
);
|
||||
|
||||
if (configuration.useKillswitch && killSwitchIsActive) return;
|
||||
if (configuration.useKillswitch && !isAllowedToPassThrough) return;
|
||||
|
||||
if (!configuration.showIntroduction ||
|
||||
(introductionSeen && !configuration.alwaysShowIntroduction)) {
|
||||
|
|
Loading…
Reference in a new issue