Skip to content

Commit

Permalink
snackbar notif component, connectivity check
Browse files Browse the repository at this point in the history
Issue: #541
  • Loading branch information
AlphaGergedan committed Nov 7, 2024
1 parent 436b6f9 commit ce25382
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
25 changes: 25 additions & 0 deletions lib/components/notifs/snackbar.dart
Original file line number Diff line number Diff line change
@@ -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),
),
);
}
}
5 changes: 2 additions & 3 deletions lib/pages/editor/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -1722,9 +1723,7 @@ class EditorState extends State<Editor> {

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) {
Expand Down

0 comments on commit ce25382

Please sign in to comment.