From a683748a33cc10a79ef5317a945dc3ad659fcb1a Mon Sep 17 00:00:00 2001 From: klockky Date: Sun, 5 Apr 2026 13:28:22 +0300 Subject: [PATCH] fix(ui): center folder tab labels in chat list --- lib/frontend/screens/chats/chat_list_screen.dart | 2 ++ lib/frontend/widgets/custom_notification.dart | 5 ++++- lib/main.dart | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/frontend/screens/chats/chat_list_screen.dart b/lib/frontend/screens/chats/chat_list_screen.dart index 4ac2dc8..1f1bf57 100644 --- a/lib/frontend/screens/chats/chat_list_screen.dart +++ b/lib/frontend/screens/chats/chat_list_screen.dart @@ -1581,6 +1581,7 @@ class _ChatListScreenState extends State } }, child: Container( + alignment: Alignment.center, padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), decoration: BoxDecoration( color: isSelected ? cs.primaryContainer : cs.surfaceContainerHigh, @@ -1588,6 +1589,7 @@ class _ChatListScreenState extends State ), child: Text( title, + textAlign: TextAlign.center, style: TextStyle( color: isSelected ? cs.onPrimaryContainer : cs.primary, fontSize: 14, diff --git a/lib/frontend/widgets/custom_notification.dart b/lib/frontend/widgets/custom_notification.dart index 85c6e91..5bdb22b 100644 --- a/lib/frontend/widgets/custom_notification.dart +++ b/lib/frontend/widgets/custom_notification.dart @@ -2,7 +2,10 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; void showCustomNotification(BuildContext context, String message) { - final overlay = Overlay.of(context); + showCustomNotificationOnOverlay(Overlay.of(context), message); +} + +void showCustomNotificationOnOverlay(OverlayState overlay, String message) { final entry = OverlayEntry( builder: (context) => CustomNotification(message: message), ); diff --git a/lib/main.dart b/lib/main.dart index 979aec2..84fcf52 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,9 +73,9 @@ class KometAppState extends State { final navState = KometApp.navigatorKey.currentState; if (navState != null) { - final overlayContext = navState.overlay?.context; - if (overlayContext != null && overlayContext.mounted) { - showCustomNotification(overlayContext, e.message); + final overlay = navState.overlay; + if (overlay != null) { + showCustomNotificationOnOverlay(overlay, e.message); } await navState.pushAndRemoveUntil(