add snackbar method for errors

test (ping) server before saving source
display error message when saving source
This commit is contained in:
austinried
2023-05-16 09:34:39 +09:00
parent 9eba5201a8
commit 8c6d4ac05f
4 changed files with 24 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
void showErrorSnackbar(BuildContext context, String message) {
final colors = Theme.of(context).colorScheme;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(message, style: TextStyle(color: colors.onErrorContainer)),
backgroundColor: colors.errorContainer,
showCloseIcon: true,
closeIconColor: colors.onErrorContainer,
behavior: SnackBarBehavior.floating,
duration: const Duration(seconds: 10),
));
}