import 'package:flutter/widgets.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

// https://pub.dev/packages/flutter_easyloading
class BytedeskLoading {
  static TransitionBuilder init() {
    return EasyLoading.init();
  }

  static void showLoading() async {
    await EasyLoading.show(
      status: '加载中...',
      maskType: EasyLoadingMaskType.black,
    );
  }

  static void showUpLoading() async {
    await EasyLoading.show(
      status: '上传中...',
      maskType: EasyLoadingMaskType.black,
    );
  }

  static void dismissLoading() async {
    await EasyLoading.dismiss();
  }

  static void showToast(String toast) {
    EasyLoading.showToast(toast);
  }

  static void showSuccess(String toast) async {
    await EasyLoading.showSuccess(toast);
  }

  static void showError(String toast) {
    EasyLoading.showError(toast);
  }

  static void showInfo(String toast) {
    EasyLoading.showInfo(toast);
  }

  static void showProgress(double progress) {
    EasyLoading.showProgress(progress);
  }
}
