feat: Added proper package references

This commit is contained in:
Jacques 2023-11-29 11:13:17 +01:00
parent 2fb48ab992
commit 36125f4174
7 changed files with 23 additions and 13 deletions

View file

@ -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

View file

@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {
buttonMode: IntroductionScreenButtonMode.text,
indicatorMode: IndicatorMode.dash,
skippable: true,
buttonBuilder: (context, onPressed, child) =>
buttonBuilder: (context, onPressed, child, type) =>
ElevatedButton(onPressed: onPressed, child: child),
),
service: service,

View file

@ -18,8 +18,9 @@ dependencies:
path: ../
flutter_introduction_shared_preferences:
git:
url: https://github.com/Iconica-Development/flutter_introduction_shared_preferences.git
ref: 1.0.0
url: https://github.com/Iconica-Development/flutter_introduction
ref: 2.0.0
path: packages/flutter_introduction_shared_preferences
dev_dependencies:
flutter_test:

View file

@ -44,6 +44,11 @@ class FirebaseIntroductionService {
}).toList();
}
Future<bool> introductionIsDisabled() async {
var document = await _documentRef.get();
return document.data()!['disabled'] as bool? ?? false;
}
Future<bool> shouldAlwaysShowIntroduction() async {
var document = await _documentRef.get();
return document.data()!['always_show'] as bool? ?? false;

View file

@ -97,10 +97,12 @@ class _IntroductionState extends State<IntroductionFirebase> {
@override
Widget build(BuildContext context) {
Future<bool> 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) {

View file

@ -1,4 +1,5 @@
name: flutter_introduction_workspace
version: 2.0.0
environment:
sdk: '>=3.1.0 <4.0.0'