any_loading

Pub support

Use without context, showToast/showSuccess/showError/showLoading/showNetLoading/showModal for Flutter.

Features

  • support Toast, ModalDialog, Loading.
  • support NetLoading. Block the ui event to delay the display of the loading bar for a few seconds.

Getting started

Add the package to your pubspec.yaml:

dependencies:
  any_loading: <latest_version>

Usage

First, initialize AnyLoading in your MaterialApp or CupertinoApp:

MaterialApp(
    title: 'Flutter Demo',
    theme: ThemeData(
    primarySwatch: Colors.blue,
    ),
    home: const TestPage(),
    builder: AnyLoading.init(),
)

Then, you can:

AnyLoading.showToast('msg');
AnyLoading.showModal(title: 'title', content: 'content', success: (bool isSuccess) => print('isSuccess--->$isSuccess'));
AnyLoading.showLoading(title: 'Loading', maskType: AnyLoadingMaskType.black, style:AnyLoadingStyle.dark());
AnyLoading.showNetLoading(title: 'Loading', position: AlignmentDirectional.center, 
                          delayShowIndicatorDuration: Duration(seconds: 5));
AnyLoading.dismiss();
// ...

Libraries

any_loading