Logo white

GitLab

liangchengyou / wow_english

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • wow_english
  • lib
  • utils
  • loading.dart
  • feat: api
    056970d8
    Key authored
    2023-06-20 19:52:43 +0800  
    Browse Code »
loading.dart 406 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import 'package:flutter_easyloading/flutter_easyloading.dart';

Future loading(Function block, {bool isShowLoading = true}) async {
  if (isShowLoading) {
    showLoading();
  }
  try {
    await block();
  } catch (e) {
    rethrow;
  } finally {
    dismissLoading();
  }
  return;
}

void showLoading() {
  EasyLoading.show(status: "加载中...");
}

void dismissLoading() {
  EasyLoading.dismiss();
}