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

View file

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