loading<T> static method
Shows a non-dismissible loading dialog.
Close it with Navigator.of(context, rootNavigator: useRootNavigator) .pop() after the operation completes.
Implementation
static Future<T?> loading<T>(
BuildContext context, {
String? message,
Widget? indicator,
bool useRootNavigator = true,
}) {
return show<T>(
context,
barrierDismissible: false,
useRootNavigator: useRootNavigator,
builder: (_) => PopScope(
canPop: false,
child: AlertDialog(
content: Row(
mainAxisSize: MainAxisSize.min,
children: [
indicator ?? const CircularProgressIndicator(),
if (message != null) ...[
const SizedBox(width: 16),
Flexible(child: Text(message)),
],
],
),
),
),
);
}