loading static method
CNLoadingToastHandle
loading({
- required BuildContext context,
- String message = 'Loading...',
- CNToastPosition position = CNToastPosition.center,
- bool useGlassEffect = true,
Shows a loading toast that must be dismissed manually.
Implementation
static CNLoadingToastHandle loading({
required BuildContext context,
String message = 'Loading...',
CNToastPosition position = CNToastPosition.center,
bool useGlassEffect = true,
}) {
final handle = CNLoadingToastHandle._();
final overlay = Overlay.of(context);
final shouldUseGlass =
PlatformVersion.supportsLiquidGlass && useGlassEffect;
handle._overlayEntry = OverlayEntry(
builder: (context) {
return _ToastOverlay(
message: message,
icon: const CupertinoActivityIndicator(),
position: position,
style: CNToastStyle.normal,
backgroundColor: null,
textColor: null,
useGlassEffect: shouldUseGlass,
onDismiss: () {},
isLoading: true,
depthNotifier: ValueNotifier(0),
autoDismissSignal: _Signal(),
);
},
);
overlay.insert(handle._overlayEntry!);
return handle;
}