mirror of
https://github.com/Iconica-Development/flutter_introduction.git
synced 2025-05-18 19:43:44 +02:00
added shared prefs variant in example
This commit is contained in:
parent
32222587cb
commit
682bb99812
4 changed files with 153 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_introduction/flutter_introduction.dart';
|
||||
import 'package:flutter_introduction_shared_preferences/flutter_introduction_shared_preferences.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
|
@ -28,7 +29,8 @@ class MyHomePage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
IntroductionService service = IntroductionService();
|
||||
IntroductionService service =
|
||||
IntroductionService(SharedPreferencesIntroductionDataProvider());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -79,6 +81,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: const Home(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -127,6 +127,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -180,6 +187,15 @@ packages:
|
|||
url: "https://github.com/Iconica-Development/flutter_introduction_service.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
flutter_introduction_shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: master
|
||||
resolved-ref: "2fa4deadeb60ff5bcde2c1f3e02791221d0dd07c"
|
||||
url: "https://github.com/Iconica-Development/flutter_introduction_shared_preferences.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
flutter_introduction_widget:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -201,6 +217,11 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -229,6 +250,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.4"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -285,6 +313,48 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.7"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -299,6 +369,62 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.7.33"
|
||||
shared_preferences:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.15"
|
||||
shared_preferences_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
shared_preferences_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_ios
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
shared_preferences_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.4"
|
||||
shared_preferences_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
shared_preferences_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.4"
|
||||
shared_preferences_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
@ -374,6 +500,20 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0+2"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -383,4 +523,4 @@ packages:
|
|||
version: "3.1.1"
|
||||
sdks:
|
||||
dart: ">=2.18.0 <3.0.0"
|
||||
flutter: ">=1.17.0"
|
||||
flutter: ">=3.0.0"
|
||||
|
|
|
@ -38,6 +38,10 @@ dependencies:
|
|||
cupertino_icons: ^1.0.2
|
||||
flutter_introduction:
|
||||
path: ../
|
||||
flutter_introduction_shared_preferences:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_introduction_shared_preferences.git
|
||||
ref: master
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
@ -11,6 +11,7 @@ class Introduction extends StatefulWidget {
|
|||
const Introduction({
|
||||
required this.navigateTo,
|
||||
required this.options,
|
||||
required this.child,
|
||||
this.physics,
|
||||
this.service,
|
||||
super.key,
|
||||
|
@ -20,6 +21,7 @@ class Introduction extends StatefulWidget {
|
|||
final IntroductionService? service;
|
||||
final IntroductionOptions options;
|
||||
final ScrollPhysics? physics;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<Introduction> createState() => _IntroductionState();
|
||||
|
@ -51,14 +53,13 @@ class _IntroductionState extends State<Introduction> {
|
|||
widget.navigateTo();
|
||||
},
|
||||
physics: widget.physics,
|
||||
onSkip: () {
|
||||
onSkip: () async {
|
||||
_service.onComplete();
|
||||
widget.navigateTo();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
widget.navigateTo();
|
||||
return Container();
|
||||
return widget.child;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue