From a48b995075e9411b0d00c5b04db194b622b30f27 Mon Sep 17 00:00:00 2001 From: mike doornenbal Date: Wed, 24 Jan 2024 15:43:17 +0100 Subject: [PATCH] fix: feedback --- README.md | 11 ++ example/lib/main.dart | 4 - .../flutter_start_userstory_go_router.dart | 5 +- .../flutter_start_userstory_navigator.dart | 4 +- pubspec.lock | 131 +++++++++++++++++- pubspec.yaml | 5 + 6 files changed, 153 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1dd21df..8eda249 100644 --- a/README.md +++ b/README.md @@ -88,3 +88,14 @@ startNavigatorUserStory(startUserStoryConfiguration, context); ``` If the splashScreenBuilder is not used the SplashScreen will be skipped. + +The `StartUserStoryConfiguration` has its own parameters, as specified below: +| Parameter | Explanation | +|-----------|-------------| +| splashScreenBuilder | The builder for the splashScreen. | +| introductionOptions | The options for the introduction. | +| introductionService | The service for the introduction. Default IntroductionService (SharedPreferencesIntroductionDataProvider()) | +| homeEntry | The widget that will be shown after the introduction. | +| introductionFallbackScreen | The widget that will be shown when the introduction is skipped. | +| introductionScrollPhysics | The scrollPhysics for the introduction. | +| showIntroduction | Whether or not the introduction should be shown. | diff --git a/example/lib/main.dart b/example/lib/main.dart index 58c7201..b984a2c 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -44,7 +44,6 @@ List getStartRoutes() => getStartStoryRoutes( config, ); -StartUserStoryConfiguration s = const StartUserStoryConfiguration(); StartUserStoryConfiguration config = StartUserStoryConfiguration( // showIntroduction: false, splashScreenBuilder: (context, onFinish) => SplashScreen( @@ -83,9 +82,6 @@ StartUserStoryConfiguration config = StartUserStoryConfiguration( buttonBuilder: (context, onPressed, child, type) => ElevatedButton(onPressed: onPressed, child: child), ), - introductionService: IntroductionService( - ExampleIntroductionDataProvider(), - ), ); class SplashScreen extends StatefulWidget { diff --git a/lib/src/user_stories/flutter_start_userstory_go_router.dart b/lib/src/user_stories/flutter_start_userstory_go_router.dart index d385619..dfb8d9c 100644 --- a/lib/src/user_stories/flutter_start_userstory_go_router.dart +++ b/lib/src/user_stories/flutter_start_userstory_go_router.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_introduction/flutter_introduction.dart'; +import 'package:flutter_introduction_shared_preferences/flutter_introduction_shared_preferences.dart'; import 'package:flutter_start/src/go_router.dart'; import 'package:flutter_start/src/models/start_configuration.dart'; import 'package:flutter_start/src/routes.dart'; @@ -39,7 +40,9 @@ List getStartStoryRoutes( path: StartUserStoryRoutes.introduction, pageBuilder: (context, state) { var introduction = Introduction( - service: configuration.introductionService, + service: configuration.introductionService ?? + IntroductionService( + SharedPreferencesIntroductionDataProvider()), navigateTo: () { context.go(StartUserStoryRoutes.home); }, diff --git a/lib/src/user_stories/flutter_start_userstory_navigator.dart b/lib/src/user_stories/flutter_start_userstory_navigator.dart index ff580e1..bdb84a8 100644 --- a/lib/src/user_stories/flutter_start_userstory_navigator.dart +++ b/lib/src/user_stories/flutter_start_userstory_navigator.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_introduction_shared_preferences/flutter_introduction_shared_preferences.dart'; import 'package:flutter_start/flutter_start.dart'; Widget startNavigatorUserStory( @@ -40,7 +41,8 @@ Widget _introduction( BuildContext context, ) { var introduction = Introduction( - service: configuration.introductionService, + service: configuration.introductionService ?? + IntroductionService(SharedPreferencesIntroductionDataProvider()), navigateTo: () { Navigator.of(context).pushReplacement( MaterialPageRoute( diff --git a/pubspec.lock b/pubspec.lock index 1f5b628..41d5f5f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -137,6 +137,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" file: dependency: transitive description: @@ -194,6 +202,15 @@ packages: url: "https://github.com/Iconica-Development/flutter_introduction" source: git version: "2.0.0" + flutter_introduction_shared_preferences: + dependency: "direct main" + description: + path: "packages/flutter_introduction_shared_preferences" + ref: "2.0.0" + resolved-ref: d4037160ce6c7d51d5d1b35b3803bc46a257c7b5 + url: "https://github.com/Iconica-Development/flutter_introduction" + source: git + version: "2.0.0" flutter_introduction_widget: dependency: transitive description: @@ -301,6 +318,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + platform: + dependency: transitive + description: + name: platform + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" pub_semver: dependency: transitive description: @@ -309,6 +366,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + shared_preferences: + dependency: transitive + description: + name: shared_preferences + sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + url: "https://pub.dev" + source: hosted + version: "2.3.5" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + url: "https://pub.dev" + source: hosted + version: "2.3.2" sky_engine: dependency: transitive description: flutter @@ -402,6 +515,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" yaml: dependency: transitive description: @@ -412,4 +541,4 @@ packages: version: "3.1.2" sdks: dart: ">=3.2.5 <4.0.0" - flutter: ">=3.10.0" + flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index caaf197..8e4d680 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,6 +15,11 @@ dependencies: url: https://github.com/Iconica-Development/flutter_introduction ref: 2.0.0 path: packages/flutter_introduction + flutter_introduction_shared_preferences: + git: + url: https://github.com/Iconica-Development/flutter_introduction + ref: 2.0.0 + path: packages/flutter_introduction_shared_preferences go_router: ^13.0.1 dev_dependencies: