fix ios setting page show chat title

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-09-03 07:21:27 +08:00
parent a9308dd992
commit 58073484fe
2 changed files with 13 additions and 8 deletions

View File

@ -27,6 +27,9 @@ class _HomePageState extends State<HomePage> {
int get selectedIndex => _selectedIndex;
final List<PageShape> _pages = [];
final _blockableOverlayState = BlockableOverlayState();
bool get isChatPageCurrentTab => isAndroid
? _selectedIndex == 1
: false; // change this when ios have chat page
void refreshPages() {
setState(() {
@ -82,13 +85,15 @@ class _HomePageState extends State<HomePage> {
unselectedItemColor: MyTheme.darkGray,
onTap: (index) => setState(() {
// close chat overlay when go chat page
if (index == 1 && _selectedIndex != index) {
gFFI.chatModel.hideChatIconOverlay();
gFFI.chatModel.hideChatWindowOverlay();
gFFI.chatModel
.mobileClearClientUnread(gFFI.chatModel.currentKey.connId);
if (_selectedIndex != index) {
_selectedIndex = index;
if (isChatPageCurrentTab) {
gFFI.chatModel.hideChatIconOverlay();
gFFI.chatModel.hideChatWindowOverlay();
gFFI.chatModel.mobileClearClientUnread(
gFFI.chatModel.currentKey.connId);
}
}
_selectedIndex = index;
}),
),
body: _pages.elementAt(_selectedIndex),
@ -98,7 +103,7 @@ class _HomePageState extends State<HomePage> {
Widget appTitle() {
final currentUser = gFFI.chatModel.currentUser;
final currentKey = gFFI.chatModel.currentKey;
if (_selectedIndex == 1 &&
if (isChatPageCurrentTab &&
currentUser != null &&
currentKey.peerId.isNotEmpty) {
final connected =

View File

@ -396,7 +396,7 @@ class ChatModel with ChangeNotifier {
parent.target?.serverModel.jumpTo(id);
}
} else {
if (HomePage.homeKey.currentState?.selectedIndex != 1 ||
if (HomePage.homeKey.currentState?.isChatPageCurrentTab != true ||
_currentKey != messagekey) {
client.unreadChatMessageCount.value += 1;
mobileUpdateUnreadSum();