1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import 'package:flutter/material.dart';
- import 'package:flutter_easyloading/flutter_easyloading.dart';
- import 'package:get/get.dart';
- class Loading {
- Loading() {
- EasyLoading.instance
- ..displayDuration = const Duration(milliseconds: 2000)
- ..indicatorType = EasyLoadingIndicatorType.ring
- ..loadingStyle = EasyLoadingStyle.custom
- ..indicatorSize = 35.0
- ..lineWidth = 2
- ..radius = 10.0
- ..progressColor = Colors.white
- ..backgroundColor = Colors.black.withOpacity(0.7)
- ..indicatorColor = Colors.white
- ..textColor = Colors.white
- ..maskColor = Colors.black.withOpacity(0.6)
- ..userInteractions = true
- ..dismissOnTap = false
- ..maskType = EasyLoadingMaskType.custom;
- }
- static void show({String? text}) {
- EasyLoading.instance.userInteractions = false;
- EasyLoading.show(status: text ?? 'loading'.tr);
- }
- static void showError(String error) {
- EasyLoading.instance.userInteractions = true;
- EasyLoading.showError(error);
- }
- static void toast(String text, {int duration = 1}) {
- EasyLoading.showToast(text, duration: Duration(seconds: duration));
- }
- static void dismiss() {
- EasyLoading.instance.userInteractions = true;
- EasyLoading.dismiss();
- }
- }
|