基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

loading.dart 718 B

4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
123456789101112131415161718192021222324252627282930313233
  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart';
  3. // loading弹窗
  4. class Loading {
  5. static LoadingDialog _dialog;
  6. static BuildContext _context;
  7. static Future show(BuildContext context, {
  8. String msg,
  9. }) async {
  10. dismiss();
  11. _context = context;
  12. _dialog = LoadingDialog(
  13. message: msg,
  14. );
  15. var result = await showDialog(context: context, child: _dialog);
  16. _context = null;
  17. _dialog = null;
  18. return result;
  19. }
  20. static dismiss() {
  21. if (_dialog != null && _context != null) {
  22. if (Navigator.canPop(_context)) {
  23. Navigator.pop(_context);
  24. }
  25. }
  26. _context = null;
  27. _dialog = null;
  28. }
  29. }