misc: initial commit
This commit is contained in:
31
.gitignore
vendored
Normal file
31
.gitignore
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Miscellaneous
|
||||||
|
*.class
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
*.swp
|
||||||
|
.DS_Store
|
||||||
|
.atom/
|
||||||
|
.buildlog/
|
||||||
|
.history
|
||||||
|
.svn/
|
||||||
|
migrate_working_dir/
|
||||||
|
|
||||||
|
# IntelliJ related
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# The .vscode folder contains launch configuration and tasks you configure in
|
||||||
|
# VS Code which you may wish to be included in version control, so this line
|
||||||
|
# is commented out by default.
|
||||||
|
#.vscode/
|
||||||
|
|
||||||
|
# Flutter/Dart/Pub related
|
||||||
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||||
|
/pubspec.lock
|
||||||
|
**/doc/api/
|
||||||
|
.dart_tool/
|
||||||
|
.flutter-plugins-dependencies
|
||||||
|
/build/
|
||||||
|
/coverage/
|
||||||
10
.metadata
Normal file
10
.metadata
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# This file tracks properties of this Flutter project.
|
||||||
|
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||||
|
#
|
||||||
|
# This file should be version controlled and should not be manually edited.
|
||||||
|
|
||||||
|
version:
|
||||||
|
revision: "d693b4b9dbac2acd4477aea4555ca6dcbea44ba2"
|
||||||
|
channel: "stable"
|
||||||
|
|
||||||
|
project_type: package
|
||||||
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## 0.0.1
|
||||||
|
|
||||||
|
* TODO: Describe initial release.
|
||||||
39
README.md
Normal file
39
README.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!--
|
||||||
|
This README describes the package. If you publish this package to pub.dev,
|
||||||
|
this README's contents appear on the landing page for your package.
|
||||||
|
|
||||||
|
For information about how to write a good package README, see the guide for
|
||||||
|
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
|
||||||
|
|
||||||
|
For general information about developing packages, see the Dart guide for
|
||||||
|
[creating packages](https://dart.dev/guides/libraries/create-packages)
|
||||||
|
and the Flutter guide for
|
||||||
|
[developing packages and plugins](https://flutter.dev/to/develop-packages).
|
||||||
|
-->
|
||||||
|
|
||||||
|
TODO: Put a short description of the package here that helps potential users
|
||||||
|
know whether this package might be useful for them.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
TODO: List what your package can do. Maybe include images, gifs, or videos.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
TODO: List prerequisites and provide or point to information on how to
|
||||||
|
start using the package.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
TODO: Include short and useful examples for package users. Add longer examples
|
||||||
|
to `/example` folder.
|
||||||
|
|
||||||
|
```dart
|
||||||
|
const like = 'sample';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional information
|
||||||
|
|
||||||
|
TODO: Tell users more about the package: where to find more information, how to
|
||||||
|
contribute to the package, how to file issues, what response they can expect
|
||||||
|
from the package authors, and more.
|
||||||
4
analysis_options.yaml
Normal file
4
analysis_options.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
# Additional information about this file can be found at
|
||||||
|
# https://dart.dev/guides/language/analysis-options
|
||||||
BIN
assets/animations/big_loaders/big_logo_splash.riv
Normal file
BIN
assets/animations/big_loaders/big_logo_splash.riv
Normal file
Binary file not shown.
BIN
assets/animations/loaders/small_loader.riv
Normal file
BIN
assets/animations/loaders/small_loader.riv
Normal file
Binary file not shown.
91
assets/images/logo/icon_machinery.svg
Normal file
91
assets/images/logo/icon_machinery.svg
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 27.9.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Слой_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 600 600" style="enable-background:new 0 0 600 600;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#29AFA0;}
|
||||||
|
.st1{fill:url(#SVGID_1_);}
|
||||||
|
.st2{fill:url(#SVGID_00000176749503728848294570000007631454724206293408_);}
|
||||||
|
.st3{fill:url(#SVGID_00000119797008934101872810000015813493202180726429_);}
|
||||||
|
.st4{fill:url(#SVGID_00000080893318283549777030000011922438232185209487_);}
|
||||||
|
</style>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M354.9,389.8l-12.3,5.9c-2.6,1.2-5.7,0.5-7.5-1.7l-6.2-7.8l-30.5,35.6h-44.5l-2.5,30.6h51.6l33-33
|
||||||
|
c2.9-2.9,8-0.9,8,3.3V434l-18.5,18.5l-15.9,15.9H250l-2.8,34.1c-0.6,7.2,5.1,13.4,12.4,13.4h90.3c8,0,14.7-6.1,15.5-14.1
|
||||||
|
l9.2-100.9c-6.8-2.8-13.1-6.5-18.8-10.9C355.6,389.7,355.2,389.6,354.9,389.8z"/>
|
||||||
|
<path class="st0" d="M556.5,84.2H441.1c-5.4,0-10.4,2.5-13.6,6.8l-117,155.3c-1.8,2.5-5.5,2.5-7.4,0L182.7,89.1
|
||||||
|
c-2.4-3.1-6-4.9-9.9-4.9H88.3c-11.3,0-20.7,8.6-21.7,19.8L31.1,502.2c-0.7,7.3,5.1,13.5,12.4,13.5h73.6c8.8,0,16.2-6.7,17-15.5
|
||||||
|
l23.3-247.8c0.3-2.8,3.9-3.8,5.6-1.6l51,66.8c15.4,1.9,27.4,15.1,27.4,31c0,1.5-0.1,3-0.3,4.5l16.7,21.9l-1.5,18.8h-7L222.4,358
|
||||||
|
c1.6-2.4,2.5-5.3,2.5-8.4c0-8.5-6.9-15.3-15.3-15.3c-8.5,0-15.3,6.9-15.3,15.3s6.9,15.3,15.3,15.3c1.4,0,2.7-0.2,4-0.5l30,40.3
|
||||||
|
l47.5,0.1l39.1-45.3c0.2-0.3,0.2-0.6,0.1-0.9c-3.8-7.9-6.4-16.5-7.5-25.4c0-0.3-0.3-0.6-0.6-0.7l-12.9-4.5
|
||||||
|
c-2.7-0.9-4.4-3.6-4.1-6.5l2.2-20.5c0.3-2.9,2.5-5.1,5.4-5.5l13.6-1.8c0.3,0,0.6-0.3,0.7-0.6c3-8.5,7.3-16.3,12.7-23.3
|
||||||
|
c0.2-0.3,0.2-0.6,0.1-0.9l-5.9-12.3c-1.2-2.6-0.5-5.7,1.7-7.5l16-13c2.2-1.8,5.4-1.8,7.7-0.1l10.8,8.4c0.3,0.2,0.6,0.2,0.9,0.1
|
||||||
|
c7.9-3.8,16.5-6.4,25.4-7.5c0.3,0,0.6-0.3,0.7-0.6l4.5-12.9c0.9-2.7,3.6-4.4,6.5-4.1l20.5,2.2c2.9,0.3,5.1,2.5,5.5,5.4l1.8,13.6
|
||||||
|
c0,0.3,0.3,0.6,0.6,0.7c8.5,3,16.3,7.3,23.3,12.7c0.3,0.2,0.6,0.2,0.9,0.1l12.3-5.9c2.6-1.2,5.7-0.5,7.5,1.7l13,16
|
||||||
|
c1.8,2.2,1.8,5.4,0.1,7.7l-8.4,10.8c-0.2,0.3-0.2,0.6-0.1,0.9c3.8,7.9,6.4,16.5,7.5,25.4c0,0.3,0.3,0.6,0.6,0.7l12.9,4.5
|
||||||
|
c2.7,0.9,4.4,3.6,4.1,6.5l-2.2,20.5c-0.3,2.9-2.5,5.1-5.4,5.5l-13.6,1.8c-0.3,0-0.6,0.3-0.7,0.6c-3,8.5-7.3,16.3-12.6,23.3
|
||||||
|
c-0.2,0.3-0.2,0.6-0.1,0.9l5.9,12.3c1.2,2.6,0.5,5.7-1.7,7.5l-16,13c-2.2,1.8-5.4,1.8-7.7,0.1l-10.8-8.4c-0.3-0.2-0.6-0.2-0.9-0.1
|
||||||
|
c-6.2,3-12.9,5.2-19.8,6.6l-8.8,96.4c-0.7,7.3,5.1,13.5,12.4,13.5h88c8.9,0,16.2-6.8,17-15.6l35.5-402.4
|
||||||
|
C569.6,90.5,563.8,84.2,556.5,84.2z"/>
|
||||||
|
<path class="st0" d="M455.1,321.8c0-26.1-21.1-47.2-47.2-47.2s-47.2,21.1-47.2,47.2s21.1,47.2,47.2,47.2S455.1,347.8,455.1,321.8z
|
||||||
|
M407.9,345.7c-13.2,0-23.9-10.7-23.9-23.9c0-13.2,10.7-23.9,23.9-23.9c13.2,0,23.9,10.7,23.9,23.9
|
||||||
|
C431.8,334.9,421.1,345.7,407.9,345.7z"/>
|
||||||
|
<path class="st0" d="M223.2,438.5c-11.4,0-20.7,9.3-20.7,20.7c0,11.4,9.3,20.7,20.7,20.7c11.4,0,20.7-9.3,20.7-20.7
|
||||||
|
C243.9,447.8,234.6,438.5,223.2,438.5z M223.2,469.1c-5.4,0-9.9-4.4-9.9-9.9c0-5.4,4.4-9.9,9.9-9.9s9.9,4.4,9.9,9.9
|
||||||
|
C233.1,464.7,228.6,469.1,223.2,469.1z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="31.0307" y1="300" x2="568.9692" y2="300">
|
||||||
|
<stop offset="0.1207" style="stop-color:#29AFA0"/>
|
||||||
|
<stop offset="0.3865" style="stop-color:#28A5A8"/>
|
||||||
|
<stop offset="0.8301" style="stop-color:#248CBD"/>
|
||||||
|
<stop offset="1" style="stop-color:#2280C7"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path class="st1" d="M354.9,389.8l-12.3,5.9c-2.6,1.2-5.7,0.5-7.5-1.7l-6.2-7.8l-30.5,35.6h-44.5l-2.5,30.6h51.6l33-33
|
||||||
|
c2.9-2.9,8-0.9,8,3.3V434l-18.5,18.5l-15.9,15.9H250l-2.8,34.1c-0.6,7.2,5.1,13.4,12.4,13.4h90.3c8,0,14.7-6.1,15.5-14.1
|
||||||
|
l9.2-100.9c-6.8-2.8-13.1-6.5-18.8-10.9C355.6,389.7,355.2,389.6,354.9,389.8z"/>
|
||||||
|
|
||||||
|
<linearGradient id="SVGID_00000046305492540345651220000013554634804106742940_" gradientUnits="userSpaceOnUse" x1="31.0307" y1="300" x2="568.9692" y2="300">
|
||||||
|
<stop offset="0.1207" style="stop-color:#29AFA0"/>
|
||||||
|
<stop offset="0.3865" style="stop-color:#28A5A8"/>
|
||||||
|
<stop offset="0.8301" style="stop-color:#248CBD"/>
|
||||||
|
<stop offset="1" style="stop-color:#2280C7"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path style="fill:url(#SVGID_00000046305492540345651220000013554634804106742940_);" d="M556.5,84.2H441.1
|
||||||
|
c-5.4,0-10.4,2.5-13.6,6.8l-117,155.3c-1.8,2.5-5.5,2.5-7.4,0L182.7,89.1c-2.4-3.1-6-4.9-9.9-4.9H88.3c-11.3,0-20.7,8.6-21.7,19.8
|
||||||
|
L31.1,502.2c-0.7,7.3,5.1,13.5,12.4,13.5h73.6c8.8,0,16.2-6.7,17-15.5l23.3-247.8c0.3-2.8,3.9-3.8,5.6-1.6l51,66.8
|
||||||
|
c15.4,1.9,27.4,15.1,27.4,31c0,1.5-0.1,3-0.3,4.5l16.7,21.9l-1.5,18.8h-7L222.4,358c1.6-2.4,2.5-5.3,2.5-8.4
|
||||||
|
c0-8.5-6.9-15.3-15.3-15.3c-8.5,0-15.3,6.9-15.3,15.3s6.9,15.3,15.3,15.3c1.4,0,2.7-0.2,4-0.5l30,40.3l47.5,0.1l39.1-45.3
|
||||||
|
c0.2-0.3,0.2-0.6,0.1-0.9c-3.8-7.9-6.4-16.5-7.5-25.4c0-0.3-0.3-0.6-0.6-0.7l-12.9-4.5c-2.7-0.9-4.4-3.6-4.1-6.5l2.2-20.5
|
||||||
|
c0.3-2.9,2.5-5.1,5.4-5.5l13.6-1.8c0.3,0,0.6-0.3,0.7-0.6c3-8.5,7.3-16.3,12.7-23.3c0.2-0.3,0.2-0.6,0.1-0.9l-5.9-12.3
|
||||||
|
c-1.2-2.6-0.5-5.7,1.7-7.5l16-13c2.2-1.8,5.4-1.8,7.7-0.1l10.8,8.4c0.3,0.2,0.6,0.2,0.9,0.1c7.9-3.8,16.5-6.4,25.4-7.5
|
||||||
|
c0.3,0,0.6-0.3,0.7-0.6l4.5-12.9c0.9-2.7,3.6-4.4,6.5-4.1l20.5,2.2c2.9,0.3,5.1,2.5,5.5,5.4l1.8,13.6c0,0.3,0.3,0.6,0.6,0.7
|
||||||
|
c8.5,3,16.3,7.3,23.3,12.7c0.3,0.2,0.6,0.2,0.9,0.1l12.3-5.9c2.6-1.2,5.7-0.5,7.5,1.7l13,16c1.8,2.2,1.8,5.4,0.1,7.7l-8.4,10.8
|
||||||
|
c-0.2,0.3-0.2,0.6-0.1,0.9c3.8,7.9,6.4,16.5,7.5,25.4c0,0.3,0.3,0.6,0.6,0.7l12.9,4.5c2.7,0.9,4.4,3.6,4.1,6.5l-2.2,20.5
|
||||||
|
c-0.3,2.9-2.5,5.1-5.4,5.5l-13.6,1.8c-0.3,0-0.6,0.3-0.7,0.6c-3,8.5-7.3,16.3-12.6,23.3c-0.2,0.3-0.2,0.6-0.1,0.9l5.9,12.3
|
||||||
|
c1.2,2.6,0.5,5.7-1.7,7.5l-16,13c-2.2,1.8-5.4,1.8-7.7,0.1l-10.8-8.4c-0.3-0.2-0.6-0.2-0.9-0.1c-6.2,3-12.9,5.2-19.8,6.6
|
||||||
|
l-8.8,96.4c-0.7,7.3,5.1,13.5,12.4,13.5h88c8.9,0,16.2-6.8,17-15.6l35.5-402.4C569.6,90.5,563.8,84.2,556.5,84.2z"/>
|
||||||
|
|
||||||
|
<linearGradient id="SVGID_00000079463528932841154360000018067169486762733715_" gradientUnits="userSpaceOnUse" x1="31.0307" y1="300" x2="568.9692" y2="300">
|
||||||
|
<stop offset="0.1207" style="stop-color:#29AFA0"/>
|
||||||
|
<stop offset="0.3865" style="stop-color:#28A5A8"/>
|
||||||
|
<stop offset="0.8301" style="stop-color:#248CBD"/>
|
||||||
|
<stop offset="1" style="stop-color:#2280C7"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path style="fill:url(#SVGID_00000079463528932841154360000018067169486762733715_);" d="M455.1,321.8c0-26.1-21.1-47.2-47.2-47.2
|
||||||
|
s-47.2,21.1-47.2,47.2s21.1,47.2,47.2,47.2S455.1,347.8,455.1,321.8z M407.9,345.7c-13.2,0-23.9-10.7-23.9-23.9
|
||||||
|
c0-13.2,10.7-23.9,23.9-23.9c13.2,0,23.9,10.7,23.9,23.9C431.8,334.9,421.1,345.7,407.9,345.7z"/>
|
||||||
|
|
||||||
|
<linearGradient id="SVGID_00000132790629417636714080000010095881301813037463_" gradientUnits="userSpaceOnUse" x1="31.0307" y1="300" x2="568.9692" y2="300">
|
||||||
|
<stop offset="0.1207" style="stop-color:#29AFA0"/>
|
||||||
|
<stop offset="0.3865" style="stop-color:#28A5A8"/>
|
||||||
|
<stop offset="0.8301" style="stop-color:#248CBD"/>
|
||||||
|
<stop offset="1" style="stop-color:#2280C7"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path style="fill:url(#SVGID_00000132790629417636714080000010095881301813037463_);" d="M223.2,438.5c-11.4,0-20.7,9.3-20.7,20.7
|
||||||
|
c0,11.4,9.3,20.7,20.7,20.7c11.4,0,20.7-9.3,20.7-20.7C243.9,447.8,234.6,438.5,223.2,438.5z M223.2,469.1c-5.4,0-9.9-4.4-9.9-9.9
|
||||||
|
c0-5.4,4.4-9.9,9.9-9.9s9.9,4.4,9.9,9.9C233.1,464.7,228.6,469.1,223.2,469.1z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 7.3 KiB |
61
example/bootstraper.dart
Normal file
61
example/bootstraper.dart
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:markettakers/main.dart';
|
||||||
|
|
||||||
|
class SimpleStage extends StageFactory {
|
||||||
|
@override
|
||||||
|
final String title = "Test";
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> get isCompleted async {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> start(StageController controller) async {
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.3);
|
||||||
|
controller.updateTitle("test 2");
|
||||||
|
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SimpleStage2 extends StageFactory {
|
||||||
|
@override
|
||||||
|
final String title = "Test 2";
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> get isCompleted async {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> start(StageController controller) async {
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.3);
|
||||||
|
controller.updateTitle("test 5");
|
||||||
|
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
init();
|
||||||
|
final completer = Completer<void>();
|
||||||
|
completer.future.then((_) {
|
||||||
|
talker.info("Bootstrapper completed, launching app");
|
||||||
|
});
|
||||||
|
runApp(
|
||||||
|
Scaffold(
|
||||||
|
body: Bootstrapper(
|
||||||
|
stages: [SimpleStage(), SimpleStage2()],
|
||||||
|
onCompleted: completer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
19
lib/main.dart
Normal file
19
lib/main.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rive_native/rive_native.dart';
|
||||||
|
import 'package:talker_flutter/talker_flutter.dart';
|
||||||
|
|
||||||
|
export 'package:markettakers/src/bootstrapper.dart'
|
||||||
|
show Bootstrapper, StageFactory, StageController;
|
||||||
|
|
||||||
|
final talker = Talker();
|
||||||
|
|
||||||
|
final commonTheme = ThemeData(
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: Colors.deepPurple,
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
).copyWith(secondary: Colors.deepPurpleAccent),
|
||||||
|
);
|
||||||
|
|
||||||
|
void init() async {
|
||||||
|
await RiveNative.init();
|
||||||
|
}
|
||||||
59
lib/markettakers.dart
Normal file
59
lib/markettakers.dart
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:markettakers/main.dart';
|
||||||
|
|
||||||
|
class SimpleStage extends StageFactory {
|
||||||
|
final String title = "Test";
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> get isCompleted async {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> start(StageController controller) async {
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.3);
|
||||||
|
controller.updateTitle("test 2");
|
||||||
|
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SimpleStage2 extends StageFactory {
|
||||||
|
final String title = "Test 2";
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> get isCompleted async {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> start(StageController controller) async {
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.3);
|
||||||
|
controller.updateTitle("test 5");
|
||||||
|
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
controller.updateProgress(0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
init();
|
||||||
|
final completer = Completer<void>();
|
||||||
|
completer.future.then((_) {
|
||||||
|
talker.info("Bootstrapper completed, launching app");
|
||||||
|
});
|
||||||
|
runApp(
|
||||||
|
Scaffold(
|
||||||
|
body: Bootstrapper(
|
||||||
|
stages: [SimpleStage(), SimpleStage2()],
|
||||||
|
onCompleted: completer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
98
lib/src/about_screen.dart
Normal file
98
lib/src/about_screen.dart
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:markettakers/main.dart';
|
||||||
|
import 'package:markettakers/src/loaders/loader.dart';
|
||||||
|
import 'package:talker_flutter/talker_flutter.dart';
|
||||||
|
|
||||||
|
class AboutScreen extends StatelessWidget {
|
||||||
|
final String decription;
|
||||||
|
final List<Widget> children;
|
||||||
|
const AboutScreen({
|
||||||
|
super.key,
|
||||||
|
required this.decription,
|
||||||
|
this.children = const [],
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: Loader(flavour: LoaderFlavour.big, playing: true),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
decription,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 16, color: Colors.grey[500]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Credits(),
|
||||||
|
|
||||||
|
Footer(children: children),
|
||||||
|
const Text("MarketTakers (c) 2025"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Footer extends StatelessWidget {
|
||||||
|
const Footer({super.key, required this.children});
|
||||||
|
|
||||||
|
final List<Widget> children;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FractionallySizedBox(
|
||||||
|
widthFactor: 0.5,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
OutlinedButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => TalkerScreen(talker: talker),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: const Text("View Logs"),
|
||||||
|
),
|
||||||
|
...children,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Credits extends StatelessWidget {
|
||||||
|
const Credits({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Text("Made with "),
|
||||||
|
const Icon(Icons.favorite, color: Colors.red),
|
||||||
|
const Text(" by Skipper, Clewerwild and karabyn2187"),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
193
lib/src/bootstrapper.dart
Normal file
193
lib/src/bootstrapper.dart
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:isolate';
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:markettakers/main.dart';
|
||||||
|
import 'package:markettakers/src/loaders/loader.dart';
|
||||||
|
|
||||||
|
part 'bootstrapper.freezed.dart';
|
||||||
|
|
||||||
|
abstract class StageFactory {
|
||||||
|
String get title;
|
||||||
|
|
||||||
|
Future<bool> get isCompleted async => false;
|
||||||
|
|
||||||
|
Future<void> start(StageController controller);
|
||||||
|
void dispose() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class StageState with _$StageState {
|
||||||
|
final String title;
|
||||||
|
final double progress;
|
||||||
|
|
||||||
|
StageState({required this.title, required this.progress});
|
||||||
|
}
|
||||||
|
|
||||||
|
class StageController extends Cubit<StageState> {
|
||||||
|
StageController({required String title})
|
||||||
|
: super(StageState(title: title, progress: 0.0));
|
||||||
|
|
||||||
|
void updateProgress(double progress) {
|
||||||
|
emit(state.copyWith(progress: progress));
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateTitle(String title) {
|
||||||
|
emit(state.copyWith(title: title));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef Stages = List<StageFactory>;
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class BootstrapState with _$BootstrapState {
|
||||||
|
final Stages stages;
|
||||||
|
final int currentStageIndex;
|
||||||
|
final StageController? controller;
|
||||||
|
|
||||||
|
StageFactory get currentStage => stages[currentStageIndex];
|
||||||
|
bool get isCompleted => currentStageIndex > stages.length;
|
||||||
|
|
||||||
|
BootstrapState(this.stages, {this.currentStageIndex = 0, this.controller});
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class BootstrapEvent with _$BootstrapEvent {
|
||||||
|
const factory BootstrapEvent.start() = StartEvent;
|
||||||
|
const factory BootstrapEvent.stageCompleted() = StageCompletedEvent;
|
||||||
|
const factory BootstrapEvent.finished() = FinishedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
class BootstrapController extends Bloc<BootstrapEvent, BootstrapState> {
|
||||||
|
BootstrapController(super.initialState) {
|
||||||
|
assert(state.stages.isNotEmpty, "Stages list cannot be empty");
|
||||||
|
|
||||||
|
on<StartEvent>((event, emit) {
|
||||||
|
talker.info("BootstrapController: Starting bootstrap process");
|
||||||
|
final controller = launchCurrentStage(
|
||||||
|
state.stages,
|
||||||
|
state.currentStageIndex,
|
||||||
|
);
|
||||||
|
emit(state.copyWith(controller: controller));
|
||||||
|
});
|
||||||
|
on<StageCompletedEvent>((event, emit) async {
|
||||||
|
talker.info("BootstrapController: ${state.currentStage.title} completed");
|
||||||
|
state.currentStage.dispose();
|
||||||
|
|
||||||
|
final nextIndex = state.currentStageIndex + 1;
|
||||||
|
final newState = state.copyWith(currentStageIndex: nextIndex);
|
||||||
|
|
||||||
|
if (newState.isCompleted) {
|
||||||
|
talker.info("BootstrapController: All stages completed");
|
||||||
|
} else if (await newState.currentStage.isCompleted) {
|
||||||
|
talker.info(
|
||||||
|
"BootstrapController: Stage ${newState.currentStage.title} already completed, skipping",
|
||||||
|
);
|
||||||
|
add(const BootstrapEvent.stageCompleted());
|
||||||
|
} else {
|
||||||
|
final nextStage = newState.currentStage;
|
||||||
|
talker.info("BootstrapController: Starting stage ${nextStage.title}");
|
||||||
|
launchCurrentStage(state.stages, nextIndex);
|
||||||
|
emit(newState);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
StageController launchCurrentStage(Stages stages, int index) {
|
||||||
|
final currentStage = stages[index];
|
||||||
|
final controller = StageController(title: currentStage.title);
|
||||||
|
|
||||||
|
Isolate.run(
|
||||||
|
() => currentStage
|
||||||
|
.start(controller)
|
||||||
|
.then((_) {
|
||||||
|
talker.info(
|
||||||
|
"BootstrapController: Stage ${currentStage.title} completed",
|
||||||
|
);
|
||||||
|
add(BootstrapEvent.stageCompleted());
|
||||||
|
})
|
||||||
|
.catchError((error) {
|
||||||
|
talker.handle(
|
||||||
|
error,
|
||||||
|
null,
|
||||||
|
"BootstrapController: Error in ${currentStage.title}",
|
||||||
|
);
|
||||||
|
addError(error);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BootstrapFooter extends StatelessWidget {
|
||||||
|
const BootstrapFooter({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocBuilder<BootstrapController, BootstrapState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
final controller = state.controller;
|
||||||
|
if (controller == null) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"${state.currentStage.title} ${controller.state.progress.toStringAsFixed(2)}%",
|
||||||
|
),
|
||||||
|
CircularProgressIndicator.adaptive(
|
||||||
|
value: controller.state.progress,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bootstrapper extends StatelessWidget {
|
||||||
|
final Stages stages;
|
||||||
|
final Completer onCompleted;
|
||||||
|
|
||||||
|
const Bootstrapper({
|
||||||
|
super.key,
|
||||||
|
required this.stages,
|
||||||
|
required this.onCompleted,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) {
|
||||||
|
final controller = BootstrapController(BootstrapState(stages));
|
||||||
|
controller.add(const BootstrapEvent.start());
|
||||||
|
controller.launchCurrentStage(stages, 0);
|
||||||
|
return controller;
|
||||||
|
},
|
||||||
|
child: BlocListener<BootstrapController, BootstrapState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state.isCompleted) {
|
||||||
|
onCompleted.complete();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 3,
|
||||||
|
child: Center(
|
||||||
|
child: Loader(flavour: LoaderFlavour.big, playing: true),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(flex: 1, child: BootstrapFooter()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
649
lib/src/bootstrapper.freezed.dart
Normal file
649
lib/src/bootstrapper.freezed.dart
Normal file
@@ -0,0 +1,649 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'bootstrapper.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StageState {
|
||||||
|
|
||||||
|
String get title; double get progress;
|
||||||
|
/// Create a copy of StageState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$StageStateCopyWith<StageState> get copyWith => _$StageStateCopyWithImpl<StageState>(this as StageState, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is StageState&&(identical(other.title, title) || other.title == title)&&(identical(other.progress, progress) || other.progress == progress));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,title,progress);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StageState(title: $title, progress: $progress)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $StageStateCopyWith<$Res> {
|
||||||
|
factory $StageStateCopyWith(StageState value, $Res Function(StageState) _then) = _$StageStateCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String title, double progress
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$StageStateCopyWithImpl<$Res>
|
||||||
|
implements $StageStateCopyWith<$Res> {
|
||||||
|
_$StageStateCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final StageState _self;
|
||||||
|
final $Res Function(StageState) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StageState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? progress = null,}) {
|
||||||
|
return _then(StageState(
|
||||||
|
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,progress: null == progress ? _self.progress : progress // ignore: cast_nullable_to_non_nullable
|
||||||
|
as double,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [StageState].
|
||||||
|
extension StageStatePatterns on StageState {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>() {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>() {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$BootstrapState {
|
||||||
|
|
||||||
|
Stages get stages; int get currentStageIndex; StageController? get controller;
|
||||||
|
/// Create a copy of BootstrapState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$BootstrapStateCopyWith<BootstrapState> get copyWith => _$BootstrapStateCopyWithImpl<BootstrapState>(this as BootstrapState, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is BootstrapState&&const DeepCollectionEquality().equals(other.stages, stages)&&(identical(other.currentStageIndex, currentStageIndex) || other.currentStageIndex == currentStageIndex)&&(identical(other.controller, controller) || other.controller == controller));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(stages),currentStageIndex,controller);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'BootstrapState(stages: $stages, currentStageIndex: $currentStageIndex, controller: $controller)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $BootstrapStateCopyWith<$Res> {
|
||||||
|
factory $BootstrapStateCopyWith(BootstrapState value, $Res Function(BootstrapState) _then) = _$BootstrapStateCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
List<StageFactory> stages, int currentStageIndex, StageController? controller
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$BootstrapStateCopyWithImpl<$Res>
|
||||||
|
implements $BootstrapStateCopyWith<$Res> {
|
||||||
|
_$BootstrapStateCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final BootstrapState _self;
|
||||||
|
final $Res Function(BootstrapState) _then;
|
||||||
|
|
||||||
|
/// Create a copy of BootstrapState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? stages = null,Object? currentStageIndex = null,Object? controller = freezed,}) {
|
||||||
|
return _then(BootstrapState(
|
||||||
|
null == stages ? _self.stages : stages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StageFactory>,currentStageIndex: null == currentStageIndex ? _self.currentStageIndex : currentStageIndex // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,controller: freezed == controller ? _self.controller : controller // ignore: cast_nullable_to_non_nullable
|
||||||
|
as StageController?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [BootstrapState].
|
||||||
|
extension BootstrapStatePatterns on BootstrapState {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>() {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>() {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$BootstrapEvent {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is BootstrapEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'BootstrapEvent()';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class $BootstrapEventCopyWith<$Res> {
|
||||||
|
$BootstrapEventCopyWith(BootstrapEvent _, $Res Function(BootstrapEvent) __);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [BootstrapEvent].
|
||||||
|
extension BootstrapEventPatterns on BootstrapEvent {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( StartEvent value)? start,TResult Function( StageCompletedEvent value)? stageCompleted,TResult Function( FinishedEvent value)? finished,required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case StartEvent() when start != null:
|
||||||
|
return start(_that);case StageCompletedEvent() when stageCompleted != null:
|
||||||
|
return stageCompleted(_that);case FinishedEvent() when finished != null:
|
||||||
|
return finished(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( StartEvent value) start,required TResult Function( StageCompletedEvent value) stageCompleted,required TResult Function( FinishedEvent value) finished,}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case StartEvent():
|
||||||
|
return start(_that);case StageCompletedEvent():
|
||||||
|
return stageCompleted(_that);case FinishedEvent():
|
||||||
|
return finished(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( StartEvent value)? start,TResult? Function( StageCompletedEvent value)? stageCompleted,TResult? Function( FinishedEvent value)? finished,}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case StartEvent() when start != null:
|
||||||
|
return start(_that);case StageCompletedEvent() when stageCompleted != null:
|
||||||
|
return stageCompleted(_that);case FinishedEvent() when finished != null:
|
||||||
|
return finished(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? start,TResult Function()? stageCompleted,TResult Function()? finished,required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case StartEvent() when start != null:
|
||||||
|
return start();case StageCompletedEvent() when stageCompleted != null:
|
||||||
|
return stageCompleted();case FinishedEvent() when finished != null:
|
||||||
|
return finished();case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() start,required TResult Function() stageCompleted,required TResult Function() finished,}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case StartEvent():
|
||||||
|
return start();case StageCompletedEvent():
|
||||||
|
return stageCompleted();case FinishedEvent():
|
||||||
|
return finished();}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? start,TResult? Function()? stageCompleted,TResult? Function()? finished,}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case StartEvent() when start != null:
|
||||||
|
return start();case StageCompletedEvent() when stageCompleted != null:
|
||||||
|
return stageCompleted();case FinishedEvent() when finished != null:
|
||||||
|
return finished();case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class StartEvent implements BootstrapEvent {
|
||||||
|
const StartEvent();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is StartEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'BootstrapEvent.start()';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class StageCompletedEvent implements BootstrapEvent {
|
||||||
|
const StageCompletedEvent();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is StageCompletedEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'BootstrapEvent.stageCompleted()';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class FinishedEvent implements BootstrapEvent {
|
||||||
|
const FinishedEvent();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is FinishedEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'BootstrapEvent.finished()';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// dart format on
|
||||||
44
lib/src/error_screen.dart
Normal file
44
lib/src/error_screen.dart
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ErrorScreen extends StatelessWidget {
|
||||||
|
final Object error;
|
||||||
|
|
||||||
|
const ErrorScreen({super.key, required this.error});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: const Icon(Icons.error, color: Colors.red, size: 200),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
text: 'Ooops... error! ',
|
||||||
|
style: Theme.of(context).textTheme.displaySmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox.square(dimension: 10),
|
||||||
|
const Icon(Icons.sentiment_very_dissatisfied),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
error.toString(),
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
67
lib/src/loaders/base_loader.dart
Normal file
67
lib/src/loaders/base_loader.dart
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:rive/rive.dart';
|
||||||
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
part 'base_loader.g.dart';
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
class LoaderState extends _$LoaderState {
|
||||||
|
@override
|
||||||
|
bool build() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop() {
|
||||||
|
state = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
state = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BaseLoader extends HookConsumerWidget {
|
||||||
|
final String filepath;
|
||||||
|
final Fit fit;
|
||||||
|
|
||||||
|
const BaseLoader({super.key, required this.filepath, this.fit = Fit.contain});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final loaderState = ref.watch(loaderStateProvider);
|
||||||
|
final animFile = useMemoized(
|
||||||
|
() => FileLoader.fromAsset(filepath, riveFactory: Factory.flutter),
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
return animFile.dispose;
|
||||||
|
}, [animFile]);
|
||||||
|
|
||||||
|
return RiveWidgetBuilder(
|
||||||
|
fileLoader: animFile,
|
||||||
|
builder: (context, state) {
|
||||||
|
switch (state) {
|
||||||
|
case RiveLoading():
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
|
||||||
|
case RiveFailed():
|
||||||
|
final message = state.error.toString();
|
||||||
|
return ErrorWidget.withDetails(
|
||||||
|
message: message,
|
||||||
|
error: FlutterError(message),
|
||||||
|
);
|
||||||
|
|
||||||
|
case RiveLoaded(:final file):
|
||||||
|
final controller = RiveWidgetController(
|
||||||
|
file,
|
||||||
|
stateMachineSelector: StateMachineSelector.byIndex(0),
|
||||||
|
);
|
||||||
|
controller.active = loaderState;
|
||||||
|
return RiveWidget(controller: controller, fit: fit);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
62
lib/src/loaders/base_loader.g.dart
Normal file
62
lib/src/loaders/base_loader.g.dart
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'base_loader.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(LoaderState)
|
||||||
|
const loaderStateProvider = LoaderStateProvider._();
|
||||||
|
|
||||||
|
final class LoaderStateProvider extends $NotifierProvider<LoaderState, bool> {
|
||||||
|
const LoaderStateProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'loaderStateProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$loaderStateHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
LoaderState create() => LoaderState();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(bool value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<bool>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$loaderStateHash() => r'e220e72e138a376390817c6e5a4051c7e2c665b3';
|
||||||
|
|
||||||
|
abstract class _$LoaderState extends $Notifier<bool> {
|
||||||
|
bool build();
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build();
|
||||||
|
final ref = this.ref as $Ref<bool, bool>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<bool, bool>,
|
||||||
|
bool,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
19
lib/src/loaders/loader.dart
Normal file
19
lib/src/loaders/loader.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:markettakers/src/loaders/base_loader.dart';
|
||||||
|
import 'package:rive/rive.dart';
|
||||||
|
|
||||||
|
enum LoaderFlavour {
|
||||||
|
small(filepath: 'assets/loaders/small_loaders/small_loader.riv'),
|
||||||
|
big(filepath: 'assets/loaders/big_loaders/big_logo_splash.riv');
|
||||||
|
|
||||||
|
const LoaderFlavour({required this.filepath});
|
||||||
|
|
||||||
|
final String filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Loader extends BaseLoader {
|
||||||
|
final LoaderFlavour flavour;
|
||||||
|
final bool playing;
|
||||||
|
|
||||||
|
Loader({super.key, required this.flavour, this.playing = false})
|
||||||
|
: super(filepath: flavour.filepath, fit: Fit.contain);
|
||||||
|
}
|
||||||
42
pubspec.yaml
Normal file
42
pubspec.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: markettakers
|
||||||
|
description: "MarketTakers library"
|
||||||
|
version: 1.0.0
|
||||||
|
publish_to: none
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: ^3.9.2
|
||||||
|
flutter: ">=1.17.0"
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
bloc: ^9.0.1
|
||||||
|
flutter:
|
||||||
|
sdk: flutter
|
||||||
|
flutter_bloc: ^9.1.1
|
||||||
|
flutter_hooks: ^0.21.3+1
|
||||||
|
freezed_annotation: ^3.1.0
|
||||||
|
hooks_riverpod: ^3.0.2
|
||||||
|
rive: ^0.14.0-dev.9
|
||||||
|
rive_native: ^0.0.12
|
||||||
|
riverpod: ^3.0.2
|
||||||
|
riverpod_annotation: ^3.0.2
|
||||||
|
talker_flutter: ^5.0.2
|
||||||
|
|
||||||
|
dev_dependencies:
|
||||||
|
flutter_test:
|
||||||
|
sdk: flutter
|
||||||
|
flutter_lints: ^5.0.0
|
||||||
|
riverpod_generator: ^3.0.2
|
||||||
|
build_runner: ^2.7.1
|
||||||
|
freezed: ^3.2.3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
flutter:
|
||||||
|
|
||||||
|
# To add assets to your package, add an assets section, like this:
|
||||||
|
# assets:
|
||||||
|
# - images/a_dot_burr.jpeg
|
||||||
|
# - images/a_dot_ham.jpeg
|
||||||
|
assets:
|
||||||
|
- assets/animations/big_loaders/
|
||||||
|
- assets/animations/loaders/
|
||||||
Reference in New Issue
Block a user