loading function
IMP: Before using this method you need to pass EasyLoading.init() in the material app
MaterialApp(
builder: EasyLoading.init(), <-
)
info: To change color of loading indicator and overlay
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: , //Set your color
),
Implementation
void loading({
required bool value,
String? title = "Loading..",
bool closeOverlays = false,
}) {
final primaryColor = Theme.of(globalContext!).primaryColor;
if (value) {
EasyLoading.instance
..indicatorType = EasyLoadingIndicatorType.ring
..maskColor = primaryColor.withOpacity(.5)
/// custom style
..loadingStyle = EasyLoadingStyle.custom
..progressColor = primaryColor
..indicatorColor = primaryColor
..backgroundColor = Colors.white
..textColor = Colors.black
///
..userInteractions = false
..animationStyle = EasyLoadingAnimationStyle.offset;
EasyLoading.show(
maskType: EasyLoadingMaskType.custom,
status: title,
dismissOnTap: kDebugMode,
);
} else {
EasyLoading.dismiss();
}
}