startNavigatorUserStory function

Future<void> startNavigatorUserStory(
  1. BuildContext context,
  2. StartUserStoryConfiguration configuration, {
  3. required void onComplete(
    1. BuildContext context
    ),
})

Enter the start user story with the Navigator 1.0 API.

Requires a Navigator widget to exist in the given context.

Customization can be done through the configuration parameter.

onComplete triggers as soon as the userstory is finished.

The context provided here is a context has a guaranteed navigator.

Implementation

Future<void> startNavigatorUserStory(
  BuildContext context,
  StartUserStoryConfiguration configuration, {
  required void Function(BuildContext context) onComplete,
}) async {
  var initialRoute = MaterialPageRoute(
    builder: (context) => _splashScreen(
      configuration,
      context,
      onComplete,
    ),
  );

  if (!configuration.showSplashScreen && configuration.showIntroduction) {
    initialRoute = MaterialPageRoute(
      builder: (context) => _introduction(
        configuration,
        context,
        onComplete,
      ),
    );
  }

  await Navigator.of(context).push(initialRoute);
}