verzth / Flutter-Progress-Dialog

Progress dialog package for flutter

Home Page:https://pub.dev/packages/sn_progress_dialog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sn Progress Dialog

Progress dialog package for flutter

Getting Started

You must add the library as a dependency to your project.

dependencies:
 sn_progress_dialog: ^1.0.6

You should then run flutter packages get

Now in your Dart code, you can use:

import 'package:sn_progress_dialog/sn_progress_dialog.dart';
Normal Progress Valuable Progress
Preparing Progress Custom Progress

Usage Example

Create Progress Dialog

ProgressDialog pd = ProgressDialog(context: context);

Set options

pd.show(max: 100, msg: 'File Downloading...');

You don't need to update state, just pass the value. You can also update the msg value(optional)

pd.update(progress value);

Completed Type

  • Use this to update the dialog when the process is finished. If it is Empty, progress automatically closes.

 completed: Completed(), // To use with default values
 completed: Completed(completedMsg: "Downloading Done !", completedImage: AssetImage("assets/completed.png"), closedDelay: 2500)

Other Properties

Dialog closes automatically when its progress status equals the max value. Use this method if you want to turn it close manually.

pd.close();

Returns whether the dialog box is open.

pd.isOpen();

Example Use With Dio

var dio = new Dio();
ProgressDialog pd = ProgressDialog(context: context);
pd.show(max: 100, msg: 'File Downloading...');
await dio.download(
  'your download_url',
  'your path',
  onReceiveProgress: (rec, total) {
    int progress = (((rec / total) * 100).toInt());
    pd.update(value: progress);
  },
);

About

Progress dialog package for flutter

https://pub.dev/packages/sn_progress_dialog

License:MIT License


Languages

Language:Dart 96.3%Language:Swift 2.7%Language:Kotlin 0.8%Language:Objective-C 0.3%