Content-Length: 348919 | pFad | http://github.com/nslogx/flutter_easyloading

14 GitHub - nslogx/flutter_easyloading: ✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Skip to content

nslogx/flutter_easyloading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter EasyLoading

pub package pub points popularity likes license stars

English | 简体中文

Live Preview

👉 https://nslogx.github.io/flutter_easyloading

Installing

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

dependencies:
  flutter_easyloading: ^latest

Import

import 'package:flutter_easyloading/flutter_easyloading.dart';

How to use

First, initialize EasyLoading in your MaterialApp/CupertinoApp:

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter EasyLoading',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter EasyLoading'),
      builder: EasyLoading.init(),
    );
  }
}

Then, enjoy yourself:

EasyLoading.show(status: 'loading...');

EasyLoading.showProgress(0.3, status: 'downloading...');

EasyLoading.showSuccess('Great Success!');

EasyLoading.showError('Failed with Error');

EasyLoading.showInfo('Useful Information.');

EasyLoading.showToast('Toast');

EasyLoading.dismiss();

Add loading status callback

EasyLoading.addStatusCallback((status) {
  print('EasyLoading Status $status');
});

Remove loading status callback(s)

EasyLoading.removeCallback(statusCallback);

EasyLoading.removeAllCallbacks();

Customize

❗️Note:

  • textColorindicatorColorprogressColorbackgroundColor only used for EasyLoadingStyle.custom.

  • maskColor only used for EasyLoadingMaskType.custom.

//github.com/ loading style, default [EasyLoadingStyle.dark].
EasyLoadingStyle loadingStyle;

//github.com/ loading indicator type, default [EasyLoadingIndicatorType.fadingCircle].
EasyLoadingIndicatorType indicatorType;

//github.com/ loading mask type, default [EasyLoadingMaskType.none].
EasyLoadingMaskType maskType;

//github.com/ toast position, default [EasyLoadingToastPosition.center].
EasyLoadingToastPosition toastPosition;

//github.com/ loading animationStyle, default [EasyLoadingAnimationStyle.opacity].
EasyLoadingAnimationStyle animationStyle;

//github.com/ loading custom animation, default null.
EasyLoadingAnimation customAnimation;

//github.com/ textAlign of status, default [TextAlign.center].
TextAlign textAlign;

//github.com/ textStyle of status, default null.
TextStyle textStyle;

//github.com/ content padding of loading.
EdgeInsets contentPadding;

//github.com/ padding of [status].
EdgeInsets textPadding;

//github.com/ size of indicator, default 40.0.
double indicatorSize;

//github.com/ radius of loading, default 5.0.
double radius;

//github.com/ fontSize of loading, default 15.0.
double fontSize;

//github.com/ width of progress indicator, default 2.0.
double progressWidth;

//github.com/ width of indicator, default 4.0, only used for [EasyLoadingIndicatorType.ring, EasyLoadingIndicatorType.dualRing].
double lineWidth;

//github.com/ display duration of [showSuccess] [showError] [showInfo], default 2000ms.
Duration displayDuration;

//github.com/ animation duration of indicator, default 200ms.
Duration animationDuration;

//github.com/ color of loading status, only used for [EasyLoadingStyle.custom].
Color textColor;

//github.com/ color of loading indicator, only used for [EasyLoadingStyle.custom].
Color indicatorColor;

//github.com/ progress color of loading, only used for [EasyLoadingStyle.custom].
Color progressColor;

//github.com/ background color of loading, only used for [EasyLoadingStyle.custom].
Color backgroundColor;

//github.com/ mask color of loading, only used for [EasyLoadingMaskType.custom].
Color maskColor;

//github.com/ should allow user interactions while loading is displayed.
bool userInteractions;

//github.com/ should dismiss on user tap.
bool dismissOnTap;

//github.com/ indicator widget of loading
Widget indicatorWidget;

//github.com/ success widget of loading
Widget successWidget;

//github.com/ error widget of loading
Widget errorWidget;

//github.com/ info widget of loading
Widget infoWidget;

Because of EasyLoading is a singleton, so you can custom loading style any where like this:

EasyLoading.instance
  ..displayDuration = const Duration(milliseconds: 2000)
  ..indicatorType = EasyLoadingIndicatorType.fadingCircle
  ..loadingStyle = EasyLoadingStyle.dark
  ..indicatorSize = 45.0
  ..radius = 10.0
  ..progressColor = Colors.yellow
  ..backgroundColor = Colors.green
  ..indicatorColor = Colors.yellow
  ..textColor = Colors.yellow
  ..maskColor = Colors.blue.withOpacity(0.5)
  ..userInteractions = true
  ..dismissOnTap = false
  ..customAnimation = CustomAnimation();

More indicatorType can see in 👉 flutter_spinkit showcase

Custom Animation

example: 👉 Custom Animation

Todo

  • add progress indicator

  • add custom animation

Changelog

CHANGELOG

License

MIT License

❤️❤️❤️

Thanks to flutter_spinkit ❤️

Supported by JetBrains Open Source









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/nslogx/flutter_easyloading

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy