Sunday, March 26, 2023

Flutter progress dialog Support both Android and iOS platform

Flutter progress dialog. Support both Android and iOS platform.

The progress dialog just display one at the same time.

The usage inspired by OpenFlutter/flutter_oktoast

Example

Usage

1. Depend

Add this to you package’s pubspec.yaml file:

dependencies:
  flutter_progress_dialog: ^0.1.0

2. Install

Run command:

$ flutter packages get

3. Import

Import in Dart code:

import 'package:flutter_progress_dialog/flutter_progress_dialog.dart';

4. Display Progress Dialog

Support two ways to display a progress dialog.

Wrap app widget
  1. Wrap your app widget
ProgressDialog(
  child: MaterialApp(),
);
  1. Exec showProgressDialog() and dismissProgressDialog() without parameters.
showProgressDialog();
//dismissProgressDialog();
Exec showProgressDialog() directly

You can exec showProgressDialog() without wrap app widget, should specify the param: context: BuildContext.

var dialog = showProgressDialog(context: context);
//dismissProgressDialog();

5. Properties

ProgressDialog have default style, and you also can custom style or other behavior.

NameTypeDesc
loadingWidgetIf specified, default widget will not show
loadingTextStringHint text, just for default widget
textStyleTextStyleHint text’s style, just for default widget
backgroundColorColorBackground color of the progress dialog
radiusdoubleRadius of the progress dialog
onDismissFunctionCallback for dismissed
textDirectionTextDirectionLoading hint text’s direction
orientationProgressOrientationThe direction of spin kit and hint text

Example

Example sources

Example APK

Example APK Download