From 11e93314c74b3c40152592891c1becf5c83c812a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 3 Dec 2025 22:19:08 +0800 Subject: [PATCH] :bug: Fix entering room white screen --- lib/screens/chat/room.dart | 18 ++++++++---------- macos/Runner.xcodeproj/project.pbxproj | 6 +++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/screens/chat/room.dart b/lib/screens/chat/room.dart index fce0bfe8..f4f02fba 100644 --- a/lib/screens/chat/room.dart +++ b/lib/screens/chat/room.dart @@ -54,8 +54,6 @@ class ChatRoomScreen extends HookConsumerWidget { final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id)); final settings = ref.watch(appSettingsNotifierProvider); - final hasOnlineCount = onlineCount.hasValue; - if (chatIdentity.isLoading || chatRoom.isLoading) { return AppScaffold( appBar: AppBar(leading: const PageBackButton()), @@ -416,13 +414,13 @@ class ChatRoomScreen extends HookConsumerWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Badge( - isLabelVisible: hasOnlineCount, - label: Text('${(onlineCount as AsyncData?)?.value}'), + isLabelVisible: (onlineCount.value ?? 0) > 1, + label: Text('${(onlineCount.value ?? 0)}'), + textStyle: GoogleFonts.robotoMono(fontSize: 10), + textColor: Colors.white, backgroundColor: - (onlineCount as AsyncData?)?.value != null && - (onlineCount as AsyncData).value > 1 - ? Colors.green - : Colors.grey, + (onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey, + offset: Offset(6, 14), child: SizedBox( height: 26, width: 26, @@ -462,7 +460,7 @@ class ChatRoomScreen extends HookConsumerWidget { children: [ Badge( isLabelVisible: (onlineCount.value ?? 0) > 1, - label: Text('${(onlineCount as AsyncData?)?.value}'), + label: Text('${(onlineCount.value ?? 0)}'), textStyle: GoogleFonts.robotoMono(fontSize: 10), backgroundColor: (onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey, @@ -734,7 +732,7 @@ class ChatRoomScreen extends HookConsumerWidget { appBar: AppBar( leading: !compactHeader ? const Center(child: PageBackButton()) : null, automaticallyImplyLeading: false, - toolbarHeight: compactHeader ? null : 80, + toolbarHeight: compactHeader ? null : 74, title: chatRoom.when( data: (room) => diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index db9570ee..09ff042d 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -613,7 +613,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 11.0; + MACOSX_DEPLOYMENT_TARGET = 12.4; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; @@ -751,7 +751,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 11.0; + MACOSX_DEPLOYMENT_TARGET = 12.4; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -777,7 +777,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 11.0; + MACOSX_DEPLOYMENT_TARGET = 12.4; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; };