mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
fix: fix routing with appbar back button
This commit is contained in:
parent
c3b03f6d38
commit
19529deb4e
2 changed files with 13 additions and 6 deletions
|
@ -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 ??
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue