From 3032e13dc9e299b8ec3eb019681176dfb11307d8 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 21 Jan 2026 16:37:03 +0100 Subject: [PATCH] Added dismiss button --- lib/service/notifying.dart | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/service/notifying.dart b/lib/service/notifying.dart index 3d51154..bb8838a 100644 --- a/lib/service/notifying.dart +++ b/lib/service/notifying.dart @@ -8,14 +8,31 @@ class Notifying { required String text, bool isError = false, }) { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( backgroundColor: Theme.of(context).colorScheme.error, - content: Text( - text, - style: isError - ? TextStyle(color: Theme.of(context).colorScheme.onError) - : null, + content: SizedBox( + height: 30, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + text, + style: isError + ? TextStyle(color: Theme.of(context).colorScheme.onError) + : null, + ), + IconButton( + onPressed: () => + ScaffoldMessenger.of(context).hideCurrentSnackBar(), + icon: Icon( + Icons.close_rounded, + color: Theme.of(context).colorScheme.onError, + ), + ), + ], + ), ), ), );