feat: update README.md

This commit is contained in:
mike doornenbal 2025-02-19 14:13:12 +01:00
parent 2db405cfdc
commit 7b84369abe
16 changed files with 649 additions and 139 deletions

136
README.md
View file

@ -3,28 +3,138 @@
![Introduction GIF](flutter_introduction_widget.gif) ![Introduction GIF](flutter_introduction_widget.gif)
Monorepo for the Flutter introduction package. Including the following packages: Monorepo for the Flutter introduction package. Including the following packages:
- Flutter Introduction
- <b>flutter_introduction:</b>
Main package for Flutter Introduction including an example. Main package for Flutter Introduction including an example.
- Flutter Introduction Firebase - <b>firebase_introduction_repository:</b>
Package to provide content from firebase. Package to provide content from firebase.
- Flutter Introduction Interface - <b>introduction_repository_interface:</b>
Interface regarding data for the Introduction widget, like whether to show the introduction or not. Interface regarding data for the Introduction widget, like whether to show the introduction or not.
- Flutter Introduction Service - <b>shared_preferences_introduction_repository:</b>
Service to handle actions done in the Introduction widget. Package to provide content from shared preferences.
- Flutter Introduction Shared Preferences
Implementation of the interface with the use of shared preferences.
- Flutter Introduction Widget
The actual widget showing the Introduction widget.
## How to use ## 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. To use this package, add `flutter_introduction` as a dependency in your pubspec.yaml file. You can get the latest version from [here](https://github.com/Iconica-Development/flutter_introduction).
```yaml
flutter_introduction:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/flutter_introduction
version: latest
```
After adding the dependency to your `pubspec.yaml` you can use the widget like this:
```dart
import 'package:flutter_introduction/flutter_introduction.dart';
class Introduction extends StatelessWidget {
const Introduction({super.key});
@override
Widget build(BuildContext context) {
return IntroductionScreen(
onDone: (context) {
// Do what you want
},
);
}
}
```
The package will work with no additional configuration.
This includes mocked data for the introduction.
To style the introduction, you can use the following parameters:
```dart
IntroductionScreen(
translations: const IntroductionTranslations(),
introductionTheme: const IntroductionTheme(),
options: const IntroductionOptions(),
onDone: (context) {
// Do what you want
},
);
```
If you want to get the data from Firebase or Shared Preferences, you can use the following code:
```yaml
shared_preferences_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/shared_preferences_introduction_repository
version: latest
firebase_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/firebase_introduction_repository
version: latest
```
```dart
import 'package:firebase_introduction_repository/firebase_introduction_repository.dart';
import 'package:shared_preferences_introduction_repository/shared_preferences_introduction_repository.dart';
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
SharedPreferencesIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
// Or
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
FirebaseIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
```
Or you can create your own repository by implementing the `IntroductionRepositoryInterface`.
```dart
class IntroductionRepository implements IntroductionRepositoryInterface {
@override
Future<List<IntroductionPageData>> fetchIntroductionPages() async {
// Get introduction data from source
throw UnimplementedError();
}
@override
Future<void> setCompleted({bool value = true}) async {
// Set introduction completed to true or false for the current user
throw UnimplementedError();
}
@override
Future<bool> shouldShow() async {
// Check if introduction should be shown for the current user
throw UnimplementedError();
}
@override
Future<void> prefetchIntroduction() async {
// Prefetch introduction data. This is optional, this function doesn't get called by the introduction widget. But can be used to prefetch data to show the introduction faster or to skip the introduction faster.
throw UnimplementedError();
}
}
```
## Issues ## Issues

View file

@ -3,28 +3,138 @@
![Introduction GIF](flutter_introduction_widget.gif) ![Introduction GIF](flutter_introduction_widget.gif)
Monorepo for the Flutter introduction package. Including the following packages: Monorepo for the Flutter introduction package. Including the following packages:
- Flutter Introduction
- <b>flutter_introduction:</b>
Main package for Flutter Introduction including an example. Main package for Flutter Introduction including an example.
- Flutter Introduction Firebase - <b>firebase_introduction_repository:</b>
Package to provide content from firebase. Package to provide content from firebase.
- Flutter Introduction Interface - <b>introduction_repository_interface:</b>
Interface regarding data for the Introduction widget, like whether to show the introduction or not. Interface regarding data for the Introduction widget, like whether to show the introduction or not.
- Flutter Introduction Service - <b>shared_preferences_introduction_repository:</b>
Service to handle actions done in the Introduction widget. Package to provide content from shared preferences.
- Flutter Introduction Shared Preferences
Implementation of the interface with the use of shared preferences.
- Flutter Introduction Widget
The actual widget showing the Introduction widget.
## How to use ## 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. To use this package, add `flutter_introduction` as a dependency in your pubspec.yaml file. You can get the latest version from [here](https://github.com/Iconica-Development/flutter_introduction).
```yaml
flutter_introduction:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/flutter_introduction
version: latest
```
After adding the dependency to your `pubspec.yaml` you can use the widget like this:
```dart
import 'package:flutter_introduction/flutter_introduction.dart';
class Introduction extends StatelessWidget {
const Introduction({super.key});
@override
Widget build(BuildContext context) {
return IntroductionScreen(
onDone: (context) {
// Do what you want
},
);
}
}
```
The package will work with no additional configuration.
This includes mocked data for the introduction.
To style the introduction, you can use the following parameters:
```dart
IntroductionScreen(
translations: const IntroductionTranslations(),
introductionTheme: const IntroductionTheme(),
options: const IntroductionOptions(),
onDone: (context) {
// Do what you want
},
);
```
If you want to get the data from Firebase or Shared Preferences, you can use the following code:
```yaml
shared_preferences_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/shared_preferences_introduction_repository
version: latest
firebase_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/firebase_introduction_repository
version: latest
```
```dart
import 'package:firebase_introduction_repository/firebase_introduction_repository.dart';
import 'package:shared_preferences_introduction_repository/shared_preferences_introduction_repository.dart';
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
SharedPreferencesIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
// Or
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
FirebaseIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
```
Or you can create your own repository by implementing the `IntroductionRepositoryInterface`.
```dart
class IntroductionRepository implements IntroductionRepositoryInterface {
@override
Future<List<IntroductionPageData>> fetchIntroductionPages() async {
// Get introduction data from source
throw UnimplementedError();
}
@override
Future<void> setCompleted({bool value = true}) async {
// Set introduction completed to true or false for the current user
throw UnimplementedError();
}
@override
Future<bool> shouldShow() async {
// Check if introduction should be shown for the current user
throw UnimplementedError();
}
@override
Future<void> prefetchIntroduction() async {
// Prefetch introduction data. This is optional, this function doesn't get called by the introduction widget. But can be used to prefetch data to show the introduction faster or to skip the introduction faster.
throw UnimplementedError();
}
}
```
## Issues ## Issues

View file

@ -1,6 +1,6 @@
name: firebase_introduction_repository name: firebase_introduction_repository
description: "A new Flutter package project." description: "Firebase implementation of the introduction repository interface"
version: 0.0.1 version: 6.0.0
publish_to: none publish_to: none
environment: environment:

View file

@ -3,28 +3,138 @@
![Introduction GIF](flutter_introduction_widget.gif) ![Introduction GIF](flutter_introduction_widget.gif)
Monorepo for the Flutter introduction package. Including the following packages: Monorepo for the Flutter introduction package. Including the following packages:
- Flutter Introduction
- <b>flutter_introduction:</b>
Main package for Flutter Introduction including an example. Main package for Flutter Introduction including an example.
- Flutter Introduction Firebase - <b>firebase_introduction_repository:</b>
Package to provide content from firebase. Package to provide content from firebase.
- Flutter Introduction Interface - <b>introduction_repository_interface:</b>
Interface regarding data for the Introduction widget, like whether to show the introduction or not. Interface regarding data for the Introduction widget, like whether to show the introduction or not.
- Flutter Introduction Service - <b>shared_preferences_introduction_repository:</b>
Service to handle actions done in the Introduction widget. Package to provide content from shared preferences.
- Flutter Introduction Shared Preferences
Implementation of the interface with the use of shared preferences.
- Flutter Introduction Widget
The actual widget showing the Introduction widget.
## How to use ## 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. To use this package, add `flutter_introduction` as a dependency in your pubspec.yaml file. You can get the latest version from [here](https://github.com/Iconica-Development/flutter_introduction).
```yaml
flutter_introduction:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/flutter_introduction
version: latest
```
After adding the dependency to your `pubspec.yaml` you can use the widget like this:
```dart
import 'package:flutter_introduction/flutter_introduction.dart';
class Introduction extends StatelessWidget {
const Introduction({super.key});
@override
Widget build(BuildContext context) {
return IntroductionScreen(
onDone: (context) {
// Do what you want
},
);
}
}
```
The package will work with no additional configuration.
This includes mocked data for the introduction.
To style the introduction, you can use the following parameters:
```dart
IntroductionScreen(
translations: const IntroductionTranslations(),
introductionTheme: const IntroductionTheme(),
options: const IntroductionOptions(),
onDone: (context) {
// Do what you want
},
);
```
If you want to get the data from Firebase or Shared Preferences, you can use the following code:
```yaml
shared_preferences_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/shared_preferences_introduction_repository
version: latest
firebase_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/firebase_introduction_repository
version: latest
```
```dart
import 'package:firebase_introduction_repository/firebase_introduction_repository.dart';
import 'package:shared_preferences_introduction_repository/shared_preferences_introduction_repository.dart';
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
SharedPreferencesIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
// Or
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
FirebaseIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
```
Or you can create your own repository by implementing the `IntroductionRepositoryInterface`.
```dart
class IntroductionRepository implements IntroductionRepositoryInterface {
@override
Future<List<IntroductionPageData>> fetchIntroductionPages() async {
// Get introduction data from source
throw UnimplementedError();
}
@override
Future<void> setCompleted({bool value = true}) async {
// Set introduction completed to true or false for the current user
throw UnimplementedError();
}
@override
Future<bool> shouldShow() async {
// Check if introduction should be shown for the current user
throw UnimplementedError();
}
@override
Future<void> prefetchIntroduction() async {
// Prefetch introduction data. This is optional, this function doesn't get called by the introduction widget. But can be used to prefetch data to show the introduction faster or to skip the introduction faster.
throw UnimplementedError();
}
}
```
## Issues ## Issues

View file

@ -1,16 +0,0 @@
# example
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

View file

@ -1,22 +1,15 @@
PODS: PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: Flutter :path: Flutter
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

View file

@ -198,7 +198,6 @@
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
AAD28D6AADDD0350DB09B76E /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -301,23 +300,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
AAD28D6AADDD0350DB09B76E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B46DFC93FEEE82B438CEFD5D /* [CP] Check Pods Manifest.lock */ = { B46DFC93FEEE82B438CEFD5D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;

View file

@ -24,8 +24,8 @@ class Introduction extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return IntroductionScreen( return IntroductionScreen(
onDone: () { onDone: (context) {
debugPrint("done"); // Do what you want
}, },
); );
} }

View file

@ -13,8 +13,6 @@ dependencies:
sdk: flutter sdk: flutter
flutter_introduction: flutter_introduction:
path: ../ path: ../
shared_preferences_introduction_repository:
path: ../../shared_preferences_introduction_repository
dev_dependencies: dev_dependencies:
flutter_lints: ^4.0.0 flutter_lints: ^4.0.0

View file

@ -26,7 +26,7 @@ class IntroductionScreen extends StatefulWidget {
final IntroductionOptions options; final IntroductionOptions options;
final IntroductionTranslations translations; final IntroductionTranslations translations;
final IntroductionTheme introductionTheme; final IntroductionTheme introductionTheme;
final Function() onDone; final Function(BuildContext context) onDone;
@override @override
State<IntroductionScreen> createState() => _IntroductionScreenState(); State<IntroductionScreen> createState() => _IntroductionScreenState();
@ -54,8 +54,8 @@ class _IntroductionScreenState extends State<IntroductionScreen> {
IntroductionScreenMode.showNever) { IntroductionScreenMode.showNever) {
shouldShow = false; shouldShow = false;
} }
if (!shouldShow!) { if (!shouldShow! && mounted) {
await widget.onDone(); await widget.onDone.call(context);
} }
} }
@ -105,9 +105,12 @@ class _IntroductionScreenState extends State<IntroductionScreen> {
options: widget.options, options: widget.options,
translations: widget.translations, translations: widget.translations,
introductionTheme: widget.introductionTheme, introductionTheme: widget.introductionTheme,
onDone: () async { onDone: (context) async {
await introductionService?.setCompleted(); await introductionService?.setCompleted();
await widget.onDone(); if (mounted) {
// ignore: use_build_context_synchronously
await widget.onDone.call(context);
}
}, },
); );
}, },
@ -128,7 +131,7 @@ class _IntroductionScreen extends StatefulWidget {
final IntroductionOptions options; final IntroductionOptions options;
final IntroductionTranslations translations; final IntroductionTranslations translations;
final List<IntroductionPage> pages; final List<IntroductionPage> pages;
final Function() onDone; final Function(BuildContext context) onDone;
final IntroductionTheme introductionTheme; final IntroductionTheme introductionTheme;
@override @override
@ -265,7 +268,7 @@ class __IntroductionScreenState extends State<_IntroductionScreen> {
showButton: true, showButton: true,
text: widget.translations.doneButton, text: widget.translations.doneButton,
onPressed: () async { onPressed: () async {
widget.onDone(); await widget.onDone(context);
}, },
), ),
], ],

View file

@ -3,28 +3,138 @@
![Introduction GIF](flutter_introduction_widget.gif) ![Introduction GIF](flutter_introduction_widget.gif)
Monorepo for the Flutter introduction package. Including the following packages: Monorepo for the Flutter introduction package. Including the following packages:
- Flutter Introduction
- <b>flutter_introduction:</b>
Main package for Flutter Introduction including an example. Main package for Flutter Introduction including an example.
- Flutter Introduction Firebase - <b>firebase_introduction_repository:</b>
Package to provide content from firebase. Package to provide content from firebase.
- Flutter Introduction Interface - <b>introduction_repository_interface:</b>
Interface regarding data for the Introduction widget, like whether to show the introduction or not. Interface regarding data for the Introduction widget, like whether to show the introduction or not.
- Flutter Introduction Service - <b>shared_preferences_introduction_repository:</b>
Service to handle actions done in the Introduction widget. Package to provide content from shared preferences.
- Flutter Introduction Shared Preferences
Implementation of the interface with the use of shared preferences.
- Flutter Introduction Widget
The actual widget showing the Introduction widget.
## How to use ## 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. To use this package, add `flutter_introduction` as a dependency in your pubspec.yaml file. You can get the latest version from [here](https://github.com/Iconica-Development/flutter_introduction).
```yaml
flutter_introduction:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/flutter_introduction
version: latest
```
After adding the dependency to your `pubspec.yaml` you can use the widget like this:
```dart
import 'package:flutter_introduction/flutter_introduction.dart';
class Introduction extends StatelessWidget {
const Introduction({super.key});
@override
Widget build(BuildContext context) {
return IntroductionScreen(
onDone: (context) {
// Do what you want
},
);
}
}
```
The package will work with no additional configuration.
This includes mocked data for the introduction.
To style the introduction, you can use the following parameters:
```dart
IntroductionScreen(
translations: const IntroductionTranslations(),
introductionTheme: const IntroductionTheme(),
options: const IntroductionOptions(),
onDone: (context) {
// Do what you want
},
);
```
If you want to get the data from Firebase or Shared Preferences, you can use the following code:
```yaml
shared_preferences_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/shared_preferences_introduction_repository
version: latest
firebase_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/firebase_introduction_repository
version: latest
```
```dart
import 'package:firebase_introduction_repository/firebase_introduction_repository.dart';
import 'package:shared_preferences_introduction_repository/shared_preferences_introduction_repository.dart';
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
SharedPreferencesIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
// Or
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
FirebaseIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
```
Or you can create your own repository by implementing the `IntroductionRepositoryInterface`.
```dart
class IntroductionRepository implements IntroductionRepositoryInterface {
@override
Future<List<IntroductionPageData>> fetchIntroductionPages() async {
// Get introduction data from source
throw UnimplementedError();
}
@override
Future<void> setCompleted({bool value = true}) async {
// Set introduction completed to true or false for the current user
throw UnimplementedError();
}
@override
Future<bool> shouldShow() async {
// Check if introduction should be shown for the current user
throw UnimplementedError();
}
@override
Future<void> prefetchIntroduction() async {
// Prefetch introduction data. This is optional, this function doesn't get called by the introduction widget. But can be used to prefetch data to show the introduction faster or to skip the introduction faster.
throw UnimplementedError();
}
}
```
## Issues ## Issues

View file

@ -1,7 +1,7 @@
import "package:introduction_repository_interface/introduction_repository_interface.dart"; import "package:introduction_repository_interface/introduction_repository_interface.dart";
class IntroductionService { class IntroductionService {
IntroductionService({ const IntroductionService({
IntroductionRepositoryInterface? introductionRepositoryInterface, IntroductionRepositoryInterface? introductionRepositoryInterface,
}) : introductionRepositoryInterface = }) : introductionRepositoryInterface =
introductionRepositoryInterface ?? LocalIntroductionRepository(); introductionRepositoryInterface ?? LocalIntroductionRepository();

View file

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences_foundation","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"shared_preferences_android","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.5/","native_build":true,"dependencies":[]}],"macos":[{"name":"shared_preferences_foundation","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2025-02-18 10:39:03.115183","version":"3.24.3","swift_package_manager_enabled":false} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences_foundation","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"shared_preferences_android","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.5/","native_build":true,"dependencies":[]}],"macos":[{"name":"shared_preferences_foundation","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/mikedoornenbal/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2025-02-19 13:37:27.288826","version":"3.24.3","swift_package_manager_enabled":false}

View file

@ -3,28 +3,138 @@
![Introduction GIF](flutter_introduction_widget.gif) ![Introduction GIF](flutter_introduction_widget.gif)
Monorepo for the Flutter introduction package. Including the following packages: Monorepo for the Flutter introduction package. Including the following packages:
- Flutter Introduction
- <b>flutter_introduction:</b>
Main package for Flutter Introduction including an example. Main package for Flutter Introduction including an example.
- Flutter Introduction Firebase - <b>firebase_introduction_repository:</b>
Package to provide content from firebase. Package to provide content from firebase.
- Flutter Introduction Interface - <b>introduction_repository_interface:</b>
Interface regarding data for the Introduction widget, like whether to show the introduction or not. Interface regarding data for the Introduction widget, like whether to show the introduction or not.
- Flutter Introduction Service - <b>shared_preferences_introduction_repository:</b>
Service to handle actions done in the Introduction widget. Package to provide content from shared preferences.
- Flutter Introduction Shared Preferences
Implementation of the interface with the use of shared preferences.
- Flutter Introduction Widget
The actual widget showing the Introduction widget.
## How to use ## 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. To use this package, add `flutter_introduction` as a dependency in your pubspec.yaml file. You can get the latest version from [here](https://github.com/Iconica-Development/flutter_introduction).
```yaml
flutter_introduction:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/flutter_introduction
version: latest
```
After adding the dependency to your `pubspec.yaml` you can use the widget like this:
```dart
import 'package:flutter_introduction/flutter_introduction.dart';
class Introduction extends StatelessWidget {
const Introduction({super.key});
@override
Widget build(BuildContext context) {
return IntroductionScreen(
onDone: (context) {
// Do what you want
},
);
}
}
```
The package will work with no additional configuration.
This includes mocked data for the introduction.
To style the introduction, you can use the following parameters:
```dart
IntroductionScreen(
translations: const IntroductionTranslations(),
introductionTheme: const IntroductionTheme(),
options: const IntroductionOptions(),
onDone: (context) {
// Do what you want
},
);
```
If you want to get the data from Firebase or Shared Preferences, you can use the following code:
```yaml
shared_preferences_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/shared_preferences_introduction_repository
version: latest
firebase_introduction_repository:
git:
url: https://github.com/Iconica-Development/flutter_introduction
path: packages/firebase_introduction_repository
version: latest
```
```dart
import 'package:firebase_introduction_repository/firebase_introduction_repository.dart';
import 'package:shared_preferences_introduction_repository/shared_preferences_introduction_repository.dart';
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
SharedPreferencesIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
// Or
IntroductionScreen(
introductionService: IntroductionService(
introductionRepositoryInterface:
FirebaseIntroductionRepository(),
),
onDone: (context) {
// Do what you want
},
);
```
Or you can create your own repository by implementing the `IntroductionRepositoryInterface`.
```dart
class IntroductionRepository implements IntroductionRepositoryInterface {
@override
Future<List<IntroductionPageData>> fetchIntroductionPages() async {
// Get introduction data from source
throw UnimplementedError();
}
@override
Future<void> setCompleted({bool value = true}) async {
// Set introduction completed to true or false for the current user
throw UnimplementedError();
}
@override
Future<bool> shouldShow() async {
// Check if introduction should be shown for the current user
throw UnimplementedError();
}
@override
Future<void> prefetchIntroduction() async {
// Prefetch introduction data. This is optional, this function doesn't get called by the introduction widget. But can be used to prefetch data to show the introduction faster or to skip the introduction faster.
throw UnimplementedError();
}
}
```
## Issues ## Issues

View file

@ -1,6 +1,6 @@
name: shared_preferences_introduction_repository name: shared_preferences_introduction_repository
description: "A new Flutter package project." description: "Shared_preference implementation of the introduction repository interface"
version: 0.0.1 version: 6.0.0
publish_to: none publish_to: none
environment: environment:

View file

@ -1,6 +1,6 @@
name: flutter_introduction_workspace name: flutter_introduction_workspace
description: The use case level package using both the flutter_introduction_widget and the flutter_introduction_service combined description: The use case level package using both the flutter_introduction_widget and the flutter_introduction_service combined
version: 5.0.0 version: 6.0.0
publish_to: None publish_to: None