https://github.com/luo3house/flutter_update_modal
Bugly style update modal on flutter
https://github.com/luo3house/flutter_update_modal
bugly flutter-package update-service upgrade-helper
Last synced: 3 months ago
JSON representation
Bugly style update modal on flutter
- Host: GitHub
- URL: https://github.com/luo3house/flutter_update_modal
- Owner: luo3house
- License: mit
- Created: 2022-10-26T16:19:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T04:44:52.000Z (over 2 years ago)
- Last Synced: 2025-01-18T06:27:30.130Z (5 months ago)
- Topics: bugly, flutter-package, update-service, upgrade-helper
- Language: Dart
- Homepage:
- Size: 166 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# update_modal
[](https://pub.dev/packages/update_modal)
[](https://luo3house.github.io/flutter_update_modal/)Bugly style update modal on flutter. It is based on UI and cross platform.
**Try the [Demo](https://luo3house.github.io/flutter_update_modal/)**
Example project is at `example/`.

## Getting Started
### Install
Add dependency to `pubspec.yaml`.
```yaml
dependencies:
update_modal: ^0.0.3
```### Implement checker, downloader, installer
```dart
class MyUpdateService implements UpdateModalService {
@override
Future cancelDownload() {
// Perform cancel download, resolve arbitary number
}@override
Future checkUpdate() async {
// Perform check update, resolve update info
// Resolve NULL means no update
return UpdateInfo()
..name = "ExampleUpdaterApp"
..version = "3.2.0"
..size = "13.6M"
..releasedAt = "2022-10-26 22:20:01"
..description = "Upgrade description";
}@override
Future dismiss() {
// Perform dismiss to cleanup
return Future.value(0);
}@override
Future install() {
// Perform install package
return Future.value(0);
}@override
Future> startDownload() {
// Perform download, resolve a stream for progress notification
// When progress > 100(e.g. 101), the modal mark state to readyToInstall
return Future.value(Stream.fromFutures([
Future.delayed(Duration(milliseconds: 150 * 1), () => 20),
Future.delayed(Duration(milliseconds: 150 * 2), () => 40),
Future.delayed(Duration(milliseconds: 150 * 3), () => 60),
Future.delayed(Duration(milliseconds: 150 * 4), () => 80),
Future.delayed(Duration(milliseconds: 150 * 5), () => 100),
// modal show [Dismiss, Install] once receive progress > 100
Future.delayed(Duration(milliseconds: 150 * 6), () => 120),
]));
}
}
```### Perform check at App startup
```dart
class MyApp extends StatefulWidget {
@override
createState() => _MyApp();
}class _MyApp extends State {
@override
initState() {
UpdateModal.init(
context,
service: UpdateModalServiceImpl(),
);
}
}
```## Debugging
Open a web server for cross-platform modal widget debugging.
```bash
make example
```or,
```bash
cd example; flutter run -d web-server --web-port=8080
```## License
MIT