💄 Optimize chat list expansion tiles and close #210

This commit is contained in:
2025-12-27 22:18:21 +08:00
parent 5d5bda7925
commit 6e7eedc026

View File

@@ -78,20 +78,27 @@ class ChatListBodyWidget extends HookConsumerWidget {
onRefresh: () => Future.sync(() { onRefresh: () => Future.sync(() {
ref.invalidate(chatRoomJoinedProvider); ref.invalidate(chatRoomJoinedProvider);
}), }),
child: Theme(
data: Theme.of(
context,
).copyWith(dividerColor: Colors.transparent),
child: Column( child: Column(
children: [ children: [
// Always show pinned chats in their own section // Always show pinned chats in their own section
if (pinnedItems.isNotEmpty) if (pinnedItems.isNotEmpty)
ExpansionTile( ExpansionTile(
backgroundColor: Theme.of( backgroundColor: Theme.of(context)
context, .colorScheme
).colorScheme.surfaceContainer.withOpacity(0.5), .surfaceContainerHighest
.withOpacity(0.5),
collapsedBackgroundColor: Theme.of( collapsedBackgroundColor: Theme.of(
context, context,
).colorScheme.surfaceContainer.withOpacity(0.5), ).colorScheme.surfaceContainer.withOpacity(0.5),
title: Text('pinnedChatRoom'.tr()), title: Text('pinnedChatRoom'.tr()),
leading: const Icon(Symbols.keep, fill: 1), leading: const Icon(Symbols.keep, fill: 1),
tilePadding: const EdgeInsets.symmetric(horizontal: 24), tilePadding: const EdgeInsets.symmetric(
horizontal: 24,
),
initiallyExpanded: true, initiallyExpanded: true,
children: [ children: [
for (final item in pinnedItems) for (final item in pinnedItems)
@@ -147,7 +154,8 @@ class ChatListBodyWidget extends HookConsumerWidget {
for (final entry in realmGroups.entries) { for (final entry in realmGroups.entries) {
final rooms = entry.value; final rooms = entry.value;
final realm = rooms.first.realm; final realm = rooms.first.realm;
final realmName = realm?.name ?? 'Unknown Realm'; final realmName =
realm?.name ?? 'Unknown Realm';
// Calculate total unread count for this realm // Calculate total unread count for this realm
final totalUnread = rooms.fold<int>( final totalUnread = rooms.fold<int>(
@@ -161,12 +169,10 @@ class ChatListBodyWidget extends HookConsumerWidget {
ExpansionTile( ExpansionTile(
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.surfaceContainer .surfaceContainerHighest
.withOpacity(0.5),
collapsedBackgroundColor: Theme.of(context)
.colorScheme
.surfaceContainer
.withOpacity(0.5), .withOpacity(0.5),
collapsedBackgroundColor:
Colors.transparent,
title: Row( title: Row(
children: [ children: [
Expanded(child: Text(realmName)), Expanded(child: Text(realmName)),
@@ -283,6 +289,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
), ),
], ],
), ),
),
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),