dialog_loader

Pub Package License: MIT

An easy way to create a loader, you can easily combine the loader with popular state management.

New Features 💥

  • The barrierDismissible default set to false on loading and will be automatically set to true when the load is complete.
  • Asset file / Image network support on the loader.

Installation

Include dialog_loader in your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  dialog_loader: version

Now in your Dart code, you can use:

import 'package:dialog_loader/dialog_loader.dart';

Preview

LoaderTheme.dialogDefaultLoaderTheme.dialogCircle
LoaderTheme.dialogDefault (left and right icon)LoaderTheme.dialogCircle (Image network)

with the dialog loader package, you can easily combine the loader with popular state management on handling state updating, like loading, error, and success state.

Usage

You can review the example of usage from the Github repo.

Create a new instance, pass the context as parameter.

  @override
  Widget build(BuildContext context) {
    DialogLoader dialogLoader = DialogLoader(context: context);

Create the default option of the loader

_dialogLoader(context) async {
      dialogLoader.show(
        theme: LoaderTheme.dialogCircle,
        title: Text("Loading"),
        leftIcon: SizedBox(
          child: CircularProgressIndicator(),
          height: 25.0,
          width: 25.0,
        ),
      );
    }

You don't need to update state, just pass the value.

void _update() {
      _dialogLoader(context);
      Future.delayed(const Duration(seconds: 4), () {
        dialogLoader.update(
          title: Text("Done"),
          leftIcon: Icon(Icons.done),
          autoClose: false,
          barrierDismissible: true,
        );
      });
    }

Constructor

NameDescriptionRequiredDefault
contextBuildcontext to render the dialogTrue

Properties

NameDescriptionRequiredDefault
themeLoader themeFalseLoaderTheme.dialogDefault,
titleWidget titleFalseContainer()
leftIconWidget on the left side of the loader, and at the top for dialogCircle themeFalseContainer()
rightIconWidget on the right side of the loaderFalseContainer()
barrierColorBarrier Color of the loaderFalseColors.black26
borderRadiusDouble value to indicate the dialog border radiusFalse5.0
backgroundColorDouble value to indicate the dialog background colorFalseColors.white
elevationDouble value to indicate the elevation borderFalse5.0
autoCloseBoolean value to indicate auto Close the loader when the processing is completeFalsetrue
barrierDismissibleBoolean value to indicate barrierDimisable on dialogFalsefalse

You like the package ? Buy me a coffee :)

buymeacoffe buymeacoffe

Libraries

dialog_loader