mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 10:53:51 +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 ??
|
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 ??
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue