Compare commits

...

14 commits

Author SHA1 Message Date
Kiril Tijsma
87bf58e6e7
Merge pull request #40 from Iconica-Development/fix/splashscreen-future
fix: always call the splashHandler with the splashScreenFuture and killswitchService when a splashScreenBuilder is provided
2025-04-30 10:01:30 +02:00
Freek van de Ven
ada23abbc5 fix: always call the splashHandler with the splashScreenFuture and killswitchService when a splashScreenBuilder is provided 2025-04-30 09:50:45 +02:00
Jacques
2c61f8d7db fix: Check with the service if the introduction should be shown before actually showing
When removing this, the introduction is briefly shown before calling the onComplete
2025-04-29 15:16:35 +02:00
Freek van de Ven
2a66e11611 chore: add component release workflow 2025-04-22 10:34:27 +02:00
0976083a9f feat(navigator): add navigator widget to allow for app independent navigation 2025-03-17 15:46:44 +01:00
6f24e0521d chore(example): add standard flutter readme 2025-03-17 15:46:44 +01:00
328a75b5a2 chore(example): add web platform to gitignore 2025-03-17 15:46:44 +01:00
Gorter-dev
ed8b5b401a
Merge pull request #37 from Iconica-Development/bugfix/introduction
fix: introduction
2024-07-30 13:19:20 +02:00
mike doornenbal
7635b8a4cc fix: introduction 2024-07-30 13:12:39 +02:00
Gorter-dev
d0b0f88ad3
Merge pull request #35 from Iconica-Development/chore/deploy
chore: ready the package for deployment to the pub server
2024-07-22 15:11:28 +02:00
Bart Ribbers
62161aa60b chore: ready the package for deployment to the pub server 2024-07-22 15:09:14 +02:00
Bart Ribbers
bf018a3ce6 chore: add fvm configuration to gitignore 2024-07-22 15:08:05 +02:00
mike doornenbal
c521be374d
Merge pull request #36 from Iconica-Development/bugfix/default_style
fix: default style and flutter_introduction to new version
2024-07-18 13:15:23 +02:00
mike doornenbal
c558c8dbc7 fix: default style and flutter_introduction to new version 2024-07-12 16:06:01 +02:00
10 changed files with 111 additions and 43 deletions

14
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,14 @@
name: Iconica Standard Component Release Workflow
# Workflow Caller version: 1.0.0
on:
release:
types: [published]
workflow_dispatch:
jobs:
call-global-iconica-workflow:
uses: Iconica-Development/.github/.github/workflows/component-release.yml@master
secrets: inherit
permissions: write-all

4
.gitignore vendored
View file

@ -44,3 +44,7 @@ app.*.map.json
ios
.metadata
pubspec.lock
# FVM Version Cache
.fvm/
.fvmrc

View file

@ -1,3 +1,15 @@
## 4.2.4
- Fixed the userstory to always call the splashScreenFuture and killswitchservice logic when a custom splashScreenBuilder is provided
## 4.2.3
- Added check if introduction should be shown according to the service before showing the introduction at all
## 4.2.2
- Added custom navigator in the root of the navigator user-story
## 4.2.1
- Updated flutter_introduction to 5.0.0
## 4.1.0
- Updated README
- Removed check if the introductions should be shown.

3
example/.gitignore vendored
View file

@ -31,6 +31,9 @@ migrate_working_dir/
.pub/
/build/
# platforms
/web
# Symbolication related
app.*.symbols

16
example/README.md Normal file
View file

@ -0,0 +1,16 @@
# 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

@ -12,10 +12,8 @@ dependencies:
flutter_start:
path: ../
flutter_introduction_shared_preferences:
git:
url: https://github.com/Iconica-Development/flutter_introduction
ref: 3.1.0
path: packages/flutter_introduction_shared_preferences
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub/
version: ^5.0.0
dev_dependencies:
flutter_test:

View file

@ -19,13 +19,11 @@ class NavigatorStartUserStory extends StatelessWidget {
final void Function(BuildContext context) onComplete;
@override
Widget build(BuildContext context) {
if (!configuration.showSplashScreen) {
return _introduction(configuration, context, onComplete);
}
return _splashScreen(configuration, context, onComplete);
}
Widget build(BuildContext context) => Navigator(
onGenerateInitialRoutes: (_, __) => [
_getInitialRoute(configuration, onComplete),
],
);
}
/// Enter the start user story with the Navigator 1.0 API.
@ -42,6 +40,15 @@ Future<void> startNavigatorUserStory(
StartUserStoryConfiguration configuration, {
required void Function(BuildContext context) onComplete,
}) async {
var initialRoute = _getInitialRoute(configuration, onComplete);
await Navigator.of(context).push(initialRoute);
}
MaterialPageRoute<dynamic> _getInitialRoute(
StartUserStoryConfiguration configuration,
void Function(BuildContext context) onComplete,
) {
var initialRoute = MaterialPageRoute(
builder: (context) => _splashScreen(
configuration,
@ -59,8 +66,7 @@ Future<void> startNavigatorUserStory(
),
);
}
await Navigator.of(context).push(initialRoute);
return initialRoute;
}
Widget _splashScreen(
@ -98,28 +104,32 @@ Widget _splashScreen(
if (configuration.useKillswitch && isAllowedToPassThrough) return;
if ((!configuration.showIntroduction) && context.mounted) {
onComplete(context);
return;
}
var introService = configuration.introductionService ??
IntroductionService(SharedPreferencesIntroductionDataProvider());
if (context.mounted) {
await navigator.pushReplacement(
MaterialPageRoute(
builder: (context) => _introduction(
configuration,
context,
onComplete,
),
var shouldShowIntroduction =
configuration.showIntroduction && await introService.shouldShow();
if (!context.mounted) return;
if (!shouldShowIntroduction) return onComplete(context);
await navigator.pushReplacement(
MaterialPageRoute(
builder: (context) => _introduction(
configuration,
context,
onComplete,
),
);
}
),
);
}
unawaited(splashHandler());
var builder = configuration.splashScreenBuilder;
if (builder == null) {
unawaited(splashHandler());
return Scaffold(
backgroundColor: configuration.splashScreenBackgroundColor,
body: Center(

View file

@ -2,5 +2,5 @@ import 'package:flutter/material.dart';
Text defaultSplashScreen(BuildContext context) => Text(
'iconinstagram',
style: Theme.of(context).textTheme.titleLarge,
style: Theme.of(context).textTheme.headlineLarge,
);

View file

@ -1,7 +1,8 @@
name: flutter_start
description: "Flutter_start is a package that allows you to jumpstart your application with a splashScreen, introduction and a home."
publish_to: "none"
version: 4.1.0
version: 4.2.4
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment:
sdk: ">=3.2.5 <4.0.0"
@ -9,20 +10,16 @@ environment:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
go_router: any
http: any
package_info_plus: any
cupertino_icons: ">=1.0.2 <2.0.0"
go_router: ">=14.2.0 <15.0.0"
http: ">=1.2.1 <2.0.0"
package_info_plus: ">=8.0.0 <9.0.0"
flutter_introduction:
git:
url: https://github.com/Iconica-Development/flutter_introduction
ref: 3.1.0
path: packages/flutter_introduction
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^5.0.0
flutter_introduction_shared_preferences:
git:
url: https://github.com/Iconica-Development/flutter_introduction
ref: 3.1.0
path: packages/flutter_introduction_shared_preferences
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub/
version: ^5.0.0
dev_dependencies:
flutter_test:

14
test/_test.dart Normal file
View file

@ -0,0 +1,14 @@
// This is an example unit test.
//
// A unit test tests a single function, method, or class. To learn more about
// writing unit tests, visit
// https://flutter.dev/docs/cookbook/testing/unit/introduction
import 'package:flutter_test/flutter_test.dart';
void main() {
group('Plus Operator', () {
test('should add two numbers together', () {
expect(1 + 1, 2);
});
});
}