fix: fix routing with appbar back button

This commit is contained in:
Vick Top 2024-04-18 16:01:34 +02:00
parent c3b03f6d38
commit 19529deb4e
2 changed files with 13 additions and 6 deletions

View file

@ -172,16 +172,14 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
iconTheme: theme.appBarTheme.iconTheme ?? iconTheme: theme.appBarTheme.iconTheme ??
const IconThemeData(color: Colors.white), const IconThemeData(color: Colors.white),
centerTitle: true, centerTitle: true,
leading: (chatModel is GroupChatModel) leading: GestureDetector(
? GestureDetector(
onTap: () { onTap: () {
Navigator.popUntil(context, (route) => route.isFirst); Navigator.popUntil(context, (route) => route.isFirst);
}, },
child: const Icon( child: const Icon(
Icons.arrow_back, Icons.arrow_back,
), ),
) ),
: null,
title: GestureDetector( title: GestureDetector(
onTap: () => widget.onPressChatTitle.call(context, chatModel!), onTap: () => widget.onPressChatTitle.call(context, chatModel!),
child: Row( child: Row(
@ -209,7 +207,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
(chatModel is GroupChatModel) (chatModel is GroupChatModel)
? chatModel.title ? chatModel.title
: (chatModel is PersonalChatModel) : (chatModel is PersonalChatModel)
? chatModel.user.fullName ?? ? chatModel.user.firstName ??
widget.translations.anonymousUser widget.translations.anonymousUser
: '', : '',
) )
@ -217,7 +215,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
(chatModel is GroupChatModel) (chatModel is GroupChatModel)
? chatModel.title ? chatModel.title
: (chatModel is PersonalChatModel) : (chatModel is PersonalChatModel)
? chatModel.user.fullName ?? ? chatModel.user.firstName ??
widget.translations.anonymousUser widget.translations.anonymousUser
: '', : '',
style: theme.appBarTheme.titleTextStyle ?? style: theme.appBarTheme.titleTextStyle ??

View file

@ -130,6 +130,15 @@ class _ChatScreenState extends State<ChatScreen> {
await widget.onNoChats!.call(); await widget.onNoChats!.call();
}); });
} }
return Center(
child: Text(
translations.noChatsFound,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
),
),
);
} else { } else {
_hasCalledOnNoChats = _hasCalledOnNoChats =
false; // Reset the flag if there are chats false; // Reset the flag if there are chats