update_modal

Creator: coderz1093

Last updated:

0 purchases

update_modal Image
update_modal Images
Add to Cart

Description:

update modal

update_modal #


Bugly style update modal on flutter. It is based on UI and cross platform.
Try the Demo
Example project is at example/.

Getting Started #
Install #
Add dependency to pubspec.yaml.
dependencies:
update_modal: ^0.0.3
copied to clipboard
Implement checker, downloader, installer #
class MyUpdateService implements UpdateModalService {
@override
Future<int> cancelDownload() {
// Perform cancel download, resolve arbitary number
}

@override
Future<UpdateInfo> 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<int> dismiss() {
// Perform dismiss to cleanup
return Future.value(0);
}

@override
Future<int> install() {
// Perform install package
return Future.value(0);
}

@override
Future<Stream<int>> 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),
]));
}
}
copied to clipboard
Perform check at App startup #
class MyApp extends StatefulWidget {
@override
createState() => _MyApp();
}

class _MyApp extends State<MyApp> {
@override
initState() {
UpdateModal.init(
context,
service: UpdateModalServiceImpl(),
);
}
}
copied to clipboard
Debugging #
Open a web server for cross-platform modal widget debugging.
Make example
copied to clipboard
or,
cd example; flutter run -d web-server --web-port=8080
copied to clipboard
License #
MIT

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.