|
|
|
@ -32,6 +32,11 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
final roomSearchResult = controller.roomSearchResult;
|
|
|
|
|
final userSearchResult = controller.userSearchResult;
|
|
|
|
|
final client = Matrix.of(context).client;
|
|
|
|
|
const dummyChatCount = 4;
|
|
|
|
|
final titleColor =
|
|
|
|
|
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100);
|
|
|
|
|
final subtitleColor =
|
|
|
|
|
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50);
|
|
|
|
|
|
|
|
|
|
return PageTransitionSwitcher(
|
|
|
|
|
transitionBuilder: (
|
|
|
|
@ -65,7 +70,6 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
key: Key(controller.activeSpaceId ?? 'Spaces'),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (controller.waitForFirstSync && client.prevBatch != null) {
|
|
|
|
|
final rooms = controller.filteredRooms;
|
|
|
|
|
final displayStoriesHeader = {
|
|
|
|
|
ActiveFilter.allChats,
|
|
|
|
@ -101,11 +105,10 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
itemCount: roomSearchResult.chunk.length,
|
|
|
|
|
itemBuilder: (context, i) => _SearchItem(
|
|
|
|
|
title: roomSearchResult.chunk[i].name ??
|
|
|
|
|
roomSearchResult.chunk[i]
|
|
|
|
|
.canonicalAlias?.localpart ??
|
|
|
|
|
roomSearchResult.chunk[i].canonicalAlias
|
|
|
|
|
?.localpart ??
|
|
|
|
|
L10n.of(context)!.group,
|
|
|
|
|
avatar:
|
|
|
|
|
roomSearchResult.chunk[i].avatarUrl,
|
|
|
|
|
avatar: roomSearchResult.chunk[i].avatarUrl,
|
|
|
|
|
onPressed: () => showAdaptiveBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (c) => PublicRoomBottomSheet(
|
|
|
|
@ -148,8 +151,8 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
onPressed: () => showAdaptiveBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (c) => ProfileBottomSheet(
|
|
|
|
|
userId: userSearchResult
|
|
|
|
|
.results[i].userId,
|
|
|
|
|
userId:
|
|
|
|
|
userSearchResult.results[i].userId,
|
|
|
|
|
outerContext: context,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -178,10 +181,8 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
child: ListTile(
|
|
|
|
|
leading: const Icon(Icons.vpn_key),
|
|
|
|
|
title: Text(L10n.of(context)!.dehydrateTor),
|
|
|
|
|
subtitle:
|
|
|
|
|
Text(L10n.of(context)!.dehydrateTorLong),
|
|
|
|
|
trailing:
|
|
|
|
|
const Icon(Icons.chevron_right_outlined),
|
|
|
|
|
subtitle: Text(L10n.of(context)!.dehydrateTorLong),
|
|
|
|
|
trailing: const Icon(Icons.chevron_right_outlined),
|
|
|
|
|
onTap: controller.dehydrate,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -191,7 +192,9 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
title: L10n.of(context)!.chats,
|
|
|
|
|
icon: const Icon(Icons.forum_outlined),
|
|
|
|
|
),
|
|
|
|
|
if (rooms.isEmpty && !controller.isSearchMode) ...[
|
|
|
|
|
if (client.prevBatch != null &&
|
|
|
|
|
rooms.isEmpty &&
|
|
|
|
|
!controller.isSearchMode) ...[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(32.0),
|
|
|
|
|
child: Column(
|
|
|
|
@ -216,55 +219,18 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (client.prevBatch == null)
|
|
|
|
|
SliverList(
|
|
|
|
|
delegate: SliverChildBuilderDelegate(
|
|
|
|
|
(BuildContext context, int i) {
|
|
|
|
|
if (!rooms[i]
|
|
|
|
|
.getLocalizedDisplayname(
|
|
|
|
|
MatrixLocals(L10n.of(context)!),
|
|
|
|
|
)
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.contains(
|
|
|
|
|
controller.searchController.text.toLowerCase(),
|
|
|
|
|
)) {
|
|
|
|
|
return const SizedBox.shrink();
|
|
|
|
|
}
|
|
|
|
|
return ChatListItem(
|
|
|
|
|
rooms[i],
|
|
|
|
|
key: Key('chat_list_item_${rooms[i].id}'),
|
|
|
|
|
selected:
|
|
|
|
|
controller.selectedRoomIds.contains(rooms[i].id),
|
|
|
|
|
onTap: controller.selectMode == SelectMode.select
|
|
|
|
|
? () => controller.toggleSelection(rooms[i].id)
|
|
|
|
|
: null,
|
|
|
|
|
onLongPress: () =>
|
|
|
|
|
controller.toggleSelection(rooms[i].id),
|
|
|
|
|
activeChat: controller.activeChat == rooms[i].id,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
childCount: rooms.length,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
const dummyChatCount = 5;
|
|
|
|
|
final titleColor =
|
|
|
|
|
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100);
|
|
|
|
|
final subtitleColor =
|
|
|
|
|
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50);
|
|
|
|
|
return ListView.builder(
|
|
|
|
|
key: const Key('dummychats'),
|
|
|
|
|
itemCount: dummyChatCount,
|
|
|
|
|
itemBuilder: (context, i) => Opacity(
|
|
|
|
|
(context, i) => Opacity(
|
|
|
|
|
opacity: (dummyChatCount - i) / dummyChatCount,
|
|
|
|
|
child: ListTile(
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: titleColor,
|
|
|
|
|
child: CircularProgressIndicator(
|
|
|
|
|
strokeWidth: 1,
|
|
|
|
|
color: Theme.of(context).textTheme.bodyLarge!.color,
|
|
|
|
|
color:
|
|
|
|
|
Theme.of(context).textTheme.bodyLarge!.color,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
title: Row(
|
|
|
|
@ -308,6 +274,41 @@ class ChatListViewBody extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
childCount: dummyChatCount,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (client.prevBatch != null)
|
|
|
|
|
SliverList(
|
|
|
|
|
delegate: SliverChildBuilderDelegate(
|
|
|
|
|
(BuildContext context, int i) {
|
|
|
|
|
if (!rooms[i]
|
|
|
|
|
.getLocalizedDisplayname(
|
|
|
|
|
MatrixLocals(L10n.of(context)!),
|
|
|
|
|
)
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.contains(
|
|
|
|
|
controller.searchController.text.toLowerCase(),
|
|
|
|
|
)) {
|
|
|
|
|
return const SizedBox.shrink();
|
|
|
|
|
}
|
|
|
|
|
return ChatListItem(
|
|
|
|
|
rooms[i],
|
|
|
|
|
key: Key('chat_list_item_${rooms[i].id}'),
|
|
|
|
|
selected:
|
|
|
|
|
controller.selectedRoomIds.contains(rooms[i].id),
|
|
|
|
|
onTap: controller.selectMode == SelectMode.select
|
|
|
|
|
? () => controller.toggleSelection(rooms[i].id)
|
|
|
|
|
: null,
|
|
|
|
|
onLongPress: () =>
|
|
|
|
|
controller.toggleSelection(rooms[i].id),
|
|
|
|
|
activeChat: controller.activeChat == rooms[i].id,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
childCount: rooms.length,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|