Blame view

lib/utils/loading.dart 406 Bytes
056970d8   Key   feat: api
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();
  }