showSnackbar static method
Implementation
static showSnackbar(BuildContext context, String msg) {
final colorScheme = Theme.of(context).colorScheme;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Center(
child: Text(
msg,
style: TextStyle(color: colorScheme.onError),
),
),
backgroundColor: colorScheme.error,
behavior: SnackBarBehavior.floating, // Optional: makes it float
duration: Duration(seconds: 3),
),
);
}