showLoading method

UniqueKey? showLoading([
  1. VoidCallback? onDismiss
])

Implementation

UniqueKey? showLoading([VoidCallback? onDismiss]) {
  if (_loadingEntry != null) return null;
  final key = UniqueKey();
  _loadingEntry = OverlayEntry(builder: (context) => _LoadingContainer(key, _loadingTheme, onDismiss));
  Yuro.currentState.overlay?.insert(_loadingEntry!);
  // 当loading显示时,拦截返回按钮事件, 去取消loading弹窗
  YuroWidgetsBindingObserver().addPopRouteListener(key, () {
    onDismiss?.call();
    dismissLoading(key);
    return true;
  });
  return key;
}