From 36125f4174ed1ac8aa645ae2a01e950b16a5de65 Mon Sep 17 00:00:00 2001 From: Jacques Date: Wed, 29 Nov 2023 11:13:17 +0100 Subject: [PATCH] feat: Added proper package references --- README.md | 13 +++++++------ packages/flutter_introduction/example/lib/main.dart | 2 +- packages/flutter_introduction/example/pubspec.yaml | 7 ++++--- .../lib/src/firebase_service.dart | 5 +++++ .../lib/src/introduction_widget.dart | 6 ++++-- packages/flutter_introduction_service/pubspec.yaml | 2 +- pubspec.yaml | 1 + 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6db774b..e5d1af6 100644 --- a/README.md +++ b/README.md @@ -2,26 +2,27 @@ Monorepo for the Flutter introduction package. Including the following packages: - Flutter Introduction - Main packge for Flutter Introduction. + Main packge for Flutter Introduction including an example. - Flutter Introduction Firebase Package to provide content from firebase. - Flutter Introduction Interface - + Interface regarding data for the Introduction widget, like wether to show the introduction or not. - Flutter Introduction Service + Service to handle actions done in the Introduction widget. - Flutter Introduction Shared Preferences + Implementation of the interface with the use of shared preferences. - Flutter Introduction Widget - - -## Setup - + The actual widget showing the Introduction widget. ## How to use +The simple way to use this package is by using the flutter_introduction package. An example is included if needed. +If needed a custom implementation can be made on the interface if the shared preferences doesn't suffice. ## Issues diff --git a/packages/flutter_introduction/example/lib/main.dart b/packages/flutter_introduction/example/lib/main.dart index 01f3a6c..d82239d 100644 --- a/packages/flutter_introduction/example/lib/main.dart +++ b/packages/flutter_introduction/example/lib/main.dart @@ -69,7 +69,7 @@ class _MyHomePageState extends State { buttonMode: IntroductionScreenButtonMode.text, indicatorMode: IndicatorMode.dash, skippable: true, - buttonBuilder: (context, onPressed, child) => + buttonBuilder: (context, onPressed, child, type) => ElevatedButton(onPressed: onPressed, child: child), ), service: service, diff --git a/packages/flutter_introduction/example/pubspec.yaml b/packages/flutter_introduction/example/pubspec.yaml index 1de9587..b8a4f97 100644 --- a/packages/flutter_introduction/example/pubspec.yaml +++ b/packages/flutter_introduction/example/pubspec.yaml @@ -17,9 +17,10 @@ dependencies: flutter_introduction: path: ../ flutter_introduction_shared_preferences: - git: - url: https://github.com/Iconica-Development/flutter_introduction_shared_preferences.git - ref: 1.0.0 + git: + url: https://github.com/Iconica-Development/flutter_introduction + ref: 2.0.0 + path: packages/flutter_introduction_shared_preferences dev_dependencies: flutter_test: diff --git a/packages/flutter_introduction_firebase/lib/src/firebase_service.dart b/packages/flutter_introduction_firebase/lib/src/firebase_service.dart index de1cfb9..0e6f51e 100644 --- a/packages/flutter_introduction_firebase/lib/src/firebase_service.dart +++ b/packages/flutter_introduction_firebase/lib/src/firebase_service.dart @@ -44,6 +44,11 @@ class FirebaseIntroductionService { }).toList(); } + Future introductionIsDisabled() async { + var document = await _documentRef.get(); + return document.data()!['disabled'] as bool? ?? false; + } + Future shouldAlwaysShowIntroduction() async { var document = await _documentRef.get(); return document.data()!['always_show'] as bool? ?? false; diff --git a/packages/flutter_introduction_firebase/lib/src/introduction_widget.dart b/packages/flutter_introduction_firebase/lib/src/introduction_widget.dart index 1612bf8..94905ff 100644 --- a/packages/flutter_introduction_firebase/lib/src/introduction_widget.dart +++ b/packages/flutter_introduction_firebase/lib/src/introduction_widget.dart @@ -97,10 +97,12 @@ class _IntroductionState extends State { @override Widget build(BuildContext context) { Future shouldShow() async => - await _service.shouldShow() || - await _firebaseService.shouldAlwaysShowIntroduction(); + !await _firebaseService.introductionIsDisabled() && + (await _service.shouldShow() || + await _firebaseService.shouldAlwaysShowIntroduction()); var languageCode = widget.languageCodeOverride ?? Localizations.localeOf(context).languageCode; + return FutureBuilder( future: shouldShow(), builder: (context, snapshot) { diff --git a/packages/flutter_introduction_service/pubspec.yaml b/packages/flutter_introduction_service/pubspec.yaml index 1ce0137..50d6026 100644 --- a/packages/flutter_introduction_service/pubspec.yaml +++ b/packages/flutter_introduction_service/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: url: https://github.com/Iconica-Development/flutter_introduction ref: 2.0.0 path: packages/flutter_introduction_interface - + dev_dependencies: flutter_test: sdk: flutter diff --git a/pubspec.yaml b/pubspec.yaml index d62de04..fcb35c8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,5 @@ name: flutter_introduction_workspace +version: 2.0.0 environment: sdk: '>=3.1.0 <4.0.0'