The loading of the next interface after the previous interface of flutter loading is closed

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

class LoadingUtil {
    
    
  static showLoading(
      {
    
    bool isKeep = false,
      EasyLoadingMaskType maskType = EasyLoadingMaskType.clear,showTxt}) {
    
    
    if (EasyLoading.isShow && !isKeep) {
    
    
      EasyLoading.dismiss();
    }
    Widget? widget;
    if(showTxt != null){
    
    
      widget  = Text(showTxt,style: const TextStyle(color: Colors.white),);
    }
    EasyLoading.show(maskType: maskType,indicator: widget);
  }


  static Future<void>? dismissLoading() {
    
    
    if (EasyLoading.isShow) {
    
    
      return EasyLoading.dismiss();
    }
    return null;
  }
}

The dispose of the previous interface is destroyed, and the init of the latter interface shows that the former interface actually turns off the loading of the latter interface, especially the interface switched by three tabs. Each interface is loaded when it is initialized, and the data is loaded. If it is not loaded, turn off the loading of the next interface when the previous interface is dispose, processing: then dispose will not be closed, and it will be closed when the navigation page is destroyed

Guess you like

Origin blog.csdn.net/weixin_44911775/article/details/130527988