🐛 Fix entering room white screen

This commit is contained in:
2025-12-03 22:19:08 +08:00
parent c8658bc0ca
commit 11e93314c7
2 changed files with 11 additions and 13 deletions

View File

@@ -54,8 +54,6 @@ class ChatRoomScreen extends HookConsumerWidget {
final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id)); final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id));
final settings = ref.watch(appSettingsNotifierProvider); final settings = ref.watch(appSettingsNotifierProvider);
final hasOnlineCount = onlineCount.hasValue;
if (chatIdentity.isLoading || chatRoom.isLoading) { if (chatIdentity.isLoading || chatRoom.isLoading) {
return AppScaffold( return AppScaffold(
appBar: AppBar(leading: const PageBackButton()), appBar: AppBar(leading: const PageBackButton()),
@@ -416,13 +414,13 @@ class ChatRoomScreen extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Badge( Badge(
isLabelVisible: hasOnlineCount, isLabelVisible: (onlineCount.value ?? 0) > 1,
label: Text('${(onlineCount as AsyncData?)?.value}'), label: Text('${(onlineCount.value ?? 0)}'),
textStyle: GoogleFonts.robotoMono(fontSize: 10),
textColor: Colors.white,
backgroundColor: backgroundColor:
(onlineCount as AsyncData?)?.value != null && (onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
(onlineCount as AsyncData).value > 1 offset: Offset(6, 14),
? Colors.green
: Colors.grey,
child: SizedBox( child: SizedBox(
height: 26, height: 26,
width: 26, width: 26,
@@ -462,7 +460,7 @@ class ChatRoomScreen extends HookConsumerWidget {
children: [ children: [
Badge( Badge(
isLabelVisible: (onlineCount.value ?? 0) > 1, isLabelVisible: (onlineCount.value ?? 0) > 1,
label: Text('${(onlineCount as AsyncData?)?.value}'), label: Text('${(onlineCount.value ?? 0)}'),
textStyle: GoogleFonts.robotoMono(fontSize: 10), textStyle: GoogleFonts.robotoMono(fontSize: 10),
backgroundColor: backgroundColor:
(onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey, (onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
@@ -734,7 +732,7 @@ class ChatRoomScreen extends HookConsumerWidget {
appBar: AppBar( appBar: AppBar(
leading: !compactHeader ? const Center(child: PageBackButton()) : null, leading: !compactHeader ? const Center(child: PageBackButton()) : null,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
toolbarHeight: compactHeader ? null : 80, toolbarHeight: compactHeader ? null : 74,
title: chatRoom.when( title: chatRoom.when(
data: data:
(room) => (room) =>

View File

@@ -613,7 +613,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 12.4;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
}; };
@@ -751,7 +751,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 12.4;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -777,7 +777,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 12.4;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
}; };