showSnackbar function
void
showSnackbar(
- BuildContext context,
- String message, {
- bool loading = false,
- int duration = 4,
Implementation
void showSnackbar(
BuildContext context,
String message, {
bool loading = false,
int duration = 4,
}) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Row(
children: [
if (loading)
Padding(
padding: EdgeInsetsDirectional.only(end: 10.0),
child: Container(
height: 20,
width: 20,
child: const CircularProgressIndicator(
color: Colors.white,
),
),
),
Text(message),
],
),
duration: Duration(seconds: duration),
),
);
}