Monday, 5 August 2019

Global loading widget with flutter



load

Global loading widget, which can be used through simple configuration.
Pure flutter library, not use native code.
It is similar to OKToast in use.

ScreenShot



Usage

  • install
Add to yaml
version is
pub package
dependencies:
  load: $latest_version
YAML
  • import
import 'package:load/load.dart';
Dart
  • wrap your application
void main() {
  runApp(
    LoadingProvider(
      child: MyApp(),
    ),
  );
}

or

LoadingProvider(
  child: MaterialApp(),
);
Dart
see example/lib/main.dart
  • show or hide dialog
showLoadingDialog();
showCustomLoadingWidget(Container()); // custom dialog
hideLoadingDialog();
Dart

Advanced Usage

Custom Loading Widget

Using LoadingThemeData and loadingWidgetBuilder
LoadingProvider(
    loadingWidgetBuilder: (ctx, data) {
    return Center(
        child: SizedBox(
        width: 30,
        height: 30,
        child: Container(
            child: CupertinoActivityIndicator(),
            color: Colors.blue,
        ),
        ),
    );
    },
    child: MyApp(),
),

image

Custom some config

All params is optional
PARAMSTYPEDEFAULT VALUEDESC
backgroundColorColorColors.black54Background transparent mask
tapDismissbooltrueWill it close when touching the background?
loadingBackgroundColorColorColors.whiteBackground color for the center Loading Widget
loadingPaddingEdgeInsetsEdgeInsets.all(8.0)Padding for the center Loading Widget
loadingSizeSizeSize(55,55)Size for the center Loading Widget
animDurationDurationDuration(milliseconds: 300)Show/Hide Time Duration

GitHub

— Read More
Latest commit to the master branch on 7-21-2019
Download as zip