modal_progress_hud 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 99

modal_progress_hud #

A simple widget wrapper to enable modal progress HUD (a modal progress indicator, HUD = Heads Up Display)

pub package Build Status Coverage Status

Inspired by this article.

Demo #


See example for details

Usage #

Add the package to your pubspec.yml file.

  modal_progress_hud: ^0.1.3

Next, import the library into your widget.

import 'package:modal_progress_hud/modal_progress_hud.dart';

Now, all you have to do is simply wrap your widget as a child of ModalProgressHUD, typically a form, together with a boolean that is maintained in local state.

bool _saving = false

Widget build(BuildContext context) {
  return Scaffold(
     body: ModalProgressHUD(child: Container(
     ), inAsyncCall: _saving),

Options #

The current parameters are customizable in the constructor

  @required inAsyncCall: bool,
  @required child: Widget,
  opacity: double,
  color: Color,
  progressIndicator: CircularProgressIndicator,
  offset: double
  dismissible: bool,

Example #

Here is an example app that demonstrates the usage.

  1. On initial load, _saving is false which causes your child widget to display
  2. When the form is submitted, _saving is set to true, which will display the modal
  3. Once the async call is complete, _saving is set back to false, hiding the modal
class SettingsPage extends StatefulWidget {
  _SettingsPageState createState() => new _SettingsPageState();

class _SettingsPageState extends State<SettingsPage> {
  bool _saving = false;

  void _submit() {

    setState(() {
      _saving = true;

    //Simulate a service call
    print('submitting to backend...');
    new Future.delayed(new Duration(seconds: 4), () {
      setState(() {
        _saving = false;

  Widget _buildWidget() {
    return new Form(
      child: new Column(
        children: [
          new SwitchListTile(
            title: const Text('Bedroom'),
            value: _bedroom,
            onChanged: (bool value) {
              setState(() {
                _bedroom = value;
            secondary: const Icon(Icons.hotel),
          new RaisedButton(
            onPressed: _submit,
            child: new Text('Save'),

  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Flutter Progress Indicator Demo'),
      body: ModalProgressHUD(child: _buildWidget(), inAsyncCall: _saving),

Update: See this article on Medium about async form validation

See the example application source for a complete sample app using the modal progress HUD. Included in the example is a method for using a form's validators while making async calls (see flutter/issues/9688 for details).

Issues and feedback #

Please file issues to send feedback or report a bug. Thank you!


  • Performance optimization
  • Improved docs


  • Added option to dismiss modal
  • Refactored example


  • Added option to position progress indicator
  • Refactored example


  • Added support for Dart 2.0


  • Pass any progress indicator
  • Added tests and code coverage
  • Refactoring for tests


  • Changed layout of README and corrected spelling


  • Updated README


  • Fixed location of demo gif file


  • Added example of use of modal progress hud with login screen, form and async calls.

[0.0.1] - July 10, 2018

  • Simple countainer widget to enable modal progress hud (progress indicator)


example #

Update: see this article on Medium about async form validation

Sample app showing how to use modal_progress_hud in a login screen that makes calls to a backend. Also shows method to manage form verification with async calls (see flutter/issues/9688 for details).

Demo #


Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  modal_progress_hud: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:modal_progress_hud/modal_progress_hud.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies