showLoading method
显示普通loading
Implementation
void showLoading({
String? message,
bool barrierDismissible = false,
ComToastConfig? config,
}) {
final baseConfig =
(config ?? ComToastConfig.getDefaultConfig(ComToastType.loading))
.copyWith(clickThrough: !barrierDismissible);
final loadingConfig = baseConfig;
loadingConfig.validate();
_loadingCount++;
if (_overlayManager.isLoadingShowing) return;
_currentLoadingKey = GlobalKey<ComLoadingWidgetState>();
final entry = OverlayEntry(
builder: (context) => ComLoadingWidget(
key: _currentLoadingKey!,
message: message,
config: loadingConfig,
barrierDismissible: barrierDismissible,
onDismiss: barrierDismissible ? () => hideLoadingImmediately() : null,
),
);
final inserted = _overlayManager.showLoadingEntry(entry);
if (!inserted) {
if (_loadingCount > 0) {
_loadingCount--;
}
_currentLoadingKey = null;
}
}