showLoading static method
- BuildContext context,
- String message, {
- Duration duration = const Duration(seconds: 2),
Shows a loading snackbar with a progress indicator.
Implementation
static void showLoading(
BuildContext context,
String message, {
Duration duration = const Duration(seconds: 2),
}) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Row(
children: [
const SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
),
),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.blue.shade600,
behavior: SnackBarBehavior.floating,
duration: duration,
),
);
}