From 8bb212ab4703e604ae9383907b0bc7c461ed453b Mon Sep 17 00:00:00 2001 From: rohansen856 Date: Wed, 4 Feb 2026 13:42:59 +0530 Subject: [PATCH 1/2] feat: added autoclosing for taskserver setup snackbar Signed-off-by: rohansen856 --- lib/app/modules/home/views/home_page_app_bar.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/app/modules/home/views/home_page_app_bar.dart b/lib/app/modules/home/views/home_page_app_bar.dart index 359c3adb..d5216391 100644 --- a/lib/app/modules/home/views/home_page_app_bar.dart +++ b/lib/app/modules/home/views/home_page_app_bar.dart @@ -1,5 +1,6 @@ // ignore_for_file: use_build_context_synchronously +import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -56,9 +57,15 @@ class HomePageAppBar extends StatelessWidget implements PreferredSizeWidget { void _showResultSnackBar(BuildContext context, String message, bool isError) { TaskwarriorColorTheme tColors = Theme.of(context).extension()!; + + ScaffoldMessenger.of(context).clearSnackBars(); + ScaffoldMessenger.of(context).showSnackBar( SnackBar( + duration: const Duration(seconds: 4), backgroundColor: tColors.secondaryBackgroundColor, + behavior: SnackBarBehavior.floating, + dismissDirection: DismissDirection.horizontal, content: Text( message, style: TextStyle( @@ -72,6 +79,7 @@ class HomePageAppBar extends StatelessWidget implements PreferredSizeWidget { .sentences .homePageSetup, onPressed: () { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); if (controller.taskchampion.value || controller.taskReplica.value) { Get.toNamed(Routes.MANAGE_TASK_CHAMPION_CREDS); @@ -84,6 +92,10 @@ class HomePageAppBar extends StatelessWidget implements PreferredSizeWidget { : null, ), ); + + Timer(const Duration(seconds: 4), () { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); + }); } @override From 825236701ca5346387efdbe38a41bf745612673c Mon Sep 17 00:00:00 2001 From: rohansen856 Date: Wed, 4 Feb 2026 18:14:33 +0530 Subject: [PATCH 2/2] refactor: switched to default snackbar behavior Signed-off-by: rohansen856 --- lib/app/modules/home/views/home_page_app_bar.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/app/modules/home/views/home_page_app_bar.dart b/lib/app/modules/home/views/home_page_app_bar.dart index d5216391..11fdf109 100644 --- a/lib/app/modules/home/views/home_page_app_bar.dart +++ b/lib/app/modules/home/views/home_page_app_bar.dart @@ -64,8 +64,6 @@ class HomePageAppBar extends StatelessWidget implements PreferredSizeWidget { SnackBar( duration: const Duration(seconds: 4), backgroundColor: tColors.secondaryBackgroundColor, - behavior: SnackBarBehavior.floating, - dismissDirection: DismissDirection.horizontal, content: Text( message, style: TextStyle(