showLoading method

void showLoading({
  1. String? message,
  2. bool barrierDismissible = false,
})

显示普通loading

Implementation

void showLoading({
  String? message,
  bool barrierDismissible = false,
}) {
  if (_overlayManager.isLoadingShowing) return;

  final loadingConfig =
      ComToastConfig.getDefaultConfig(ComToastType.loading).copyWith(
    clickThrough: !barrierDismissible, // 如果可以外部点击关闭,则不穿透
  );

  _currentLoadingKey = GlobalKey<ComLoadingWidgetState>();

  final entry = OverlayEntry(
    builder: (context) => ComLoadingWidget(
      key: _currentLoadingKey!,
      message: message,
      config: loadingConfig,
      barrierDismissible: barrierDismissible,
      onDismiss: barrierDismissible ? () => hideLoading() : null,
    ),
  );

  _overlayManager.showLoadingEntry(entry);
}