diff --git a/lib/components/notifs/snackbar.dart b/lib/components/notifs/snackbar.dart new file mode 100644 index 000000000..0837f8e0d --- /dev/null +++ b/lib/components/notifs/snackbar.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +class SnackBarNotification extends StatelessWidget { + final String message; + + const SnackBarNotification({ + super.key, + required this.message, + }); + + @override + Widget build(BuildContext context) { + return SnackBar( + content: Text(message), + ); + } + + static void show(BuildContext context, {required String message}) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + ), + ); + } +} diff --git a/lib/pages/editor/editor.dart b/lib/pages/editor/editor.dart index b53bcd237..503ee0fa3 100644 --- a/lib/pages/editor/editor.dart +++ b/lib/pages/editor/editor.dart @@ -21,6 +21,7 @@ import 'package:saber/components/canvas/canvas_preview.dart'; import 'package:saber/components/canvas/image/editor_image.dart'; import 'package:saber/components/canvas/save_indicator.dart'; import 'package:saber/components/navbar/responsive_navbar.dart'; +import 'package:saber/components/notifs/snackbar.dart'; import 'package:saber/components/theming/adaptive_alert_dialog.dart'; import 'package:saber/components/theming/adaptive_icon.dart'; import 'package:saber/components/theming/dynamic_material_app.dart'; @@ -1722,9 +1723,7 @@ class EditorState extends State { void snackBarNeedsToSaveBeforeExiting() { if (!mounted) return; - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text(t.editor.needsToSaveBeforeExiting), - )); + SnackBarNotification.show(context, message: t.editor.needsToSaveBeforeExiting); } Widget bottomSheet(BuildContext context) {