💄 Dynamic hide pinned chat if no need
This commit is contained in:
@@ -79,38 +79,39 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Always show pinned chats in their own section
|
// Always show pinned chats in their own section
|
||||||
ExpansionTile(
|
if (pinnedItems.isNotEmpty)
|
||||||
backgroundColor: Theme.of(
|
ExpansionTile(
|
||||||
context,
|
backgroundColor: Theme.of(
|
||||||
).colorScheme.surfaceContainer.withOpacity(0.5),
|
context,
|
||||||
collapsedBackgroundColor: Theme.of(
|
).colorScheme.surfaceContainer.withOpacity(0.5),
|
||||||
context,
|
collapsedBackgroundColor: Theme.of(
|
||||||
).colorScheme.surfaceContainer.withOpacity(0.5),
|
context,
|
||||||
title: Text('pinnedChatRoom'.tr()),
|
).colorScheme.surfaceContainer.withOpacity(0.5),
|
||||||
leading: const Icon(Symbols.keep, fill: 1),
|
title: Text('pinnedChatRoom'.tr()),
|
||||||
tilePadding: const EdgeInsets.symmetric(horizontal: 24),
|
leading: const Icon(Symbols.keep, fill: 1),
|
||||||
initiallyExpanded: true,
|
tilePadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
children: [
|
initiallyExpanded: true,
|
||||||
for (final item in pinnedItems)
|
children: [
|
||||||
ChatRoomListTile(
|
for (final item in pinnedItems)
|
||||||
room: item,
|
ChatRoomListTile(
|
||||||
isDirect: item.type == 1,
|
room: item,
|
||||||
onTap: () {
|
isDirect: item.type == 1,
|
||||||
if (isWideScreen(context)) {
|
onTap: () {
|
||||||
context.replaceNamed(
|
if (isWideScreen(context)) {
|
||||||
'chatRoom',
|
context.replaceNamed(
|
||||||
pathParameters: {'id': item.id},
|
'chatRoom',
|
||||||
);
|
pathParameters: {'id': item.id},
|
||||||
} else {
|
);
|
||||||
context.pushNamed(
|
} else {
|
||||||
'chatRoom',
|
context.pushNamed(
|
||||||
pathParameters: {'id': item.id},
|
'chatRoom',
|
||||||
);
|
pathParameters: {'id': item.id},
|
||||||
}
|
);
|
||||||
},
|
}
|
||||||
),
|
},
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Consumer(
|
child: Consumer(
|
||||||
builder: (context, ref, _) {
|
builder: (context, ref, _) {
|
||||||
|
|||||||
Reference in New Issue
Block a user