mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-13 03:12:35 +01:00
chore: follow up fix
This commit is contained in:
parent
7cdeb98671
commit
8f89d539d0
@ -10,6 +10,7 @@ import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
|||||||
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/space_view.dart';
|
import 'package:fluffychat/pages/chat_list/space_view.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/stories_header.dart';
|
import 'package:fluffychat/pages/chat_list/stories_header.dart';
|
||||||
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
||||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
||||||
@ -41,7 +42,14 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Builder(builder: (context) {
|
child: StreamBuilder(
|
||||||
|
key: ValueKey(client.userID.toString() +
|
||||||
|
controller.activeFilter.toString() +
|
||||||
|
controller.activeSpaceId.toString()),
|
||||||
|
stream: client.onSync.stream
|
||||||
|
.where((s) => s.hasRoomUpdate)
|
||||||
|
.rateLimit(const Duration(seconds: 1)),
|
||||||
|
builder: (context, _) {
|
||||||
if (controller.activeFilter == ActiveFilter.spaces &&
|
if (controller.activeFilter == ActiveFilter.spaces &&
|
||||||
!controller.isSearchMode) {
|
!controller.isSearchMode) {
|
||||||
return SpaceView(
|
return SpaceView(
|
||||||
@ -87,8 +95,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
onPressed: () => showModalBottomSheet(
|
onPressed: () => showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PublicRoomBottomSheet(
|
builder: (c) => PublicRoomBottomSheet(
|
||||||
roomAlias:
|
roomAlias: roomSearchResult
|
||||||
roomSearchResult.chunk[i].canonicalAlias ??
|
.chunk[i].canonicalAlias ??
|
||||||
roomSearchResult.chunk[i].roomId,
|
roomSearchResult.chunk[i].roomId,
|
||||||
outerContext: context,
|
outerContext: context,
|
||||||
chunk: roomSearchResult.chunk[i],
|
chunk: roomSearchResult.chunk[i],
|
||||||
@ -112,8 +120,10 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: userSearchResult.results.length,
|
itemCount: userSearchResult.results.length,
|
||||||
itemBuilder: (context, i) => _SearchItem(
|
itemBuilder: (context, i) => _SearchItem(
|
||||||
title: userSearchResult.results[i].displayName ??
|
title:
|
||||||
userSearchResult.results[i].userId.localpart ??
|
userSearchResult.results[i].displayName ??
|
||||||
|
userSearchResult
|
||||||
|
.results[i].userId.localpart ??
|
||||||
L10n.of(context)!.unknownDevice,
|
L10n.of(context)!.unknownDevice,
|
||||||
avatar: userSearchResult.results[i].avatarUrl,
|
avatar: userSearchResult.results[i].avatarUrl,
|
||||||
onPressed: () => showModalBottomSheet(
|
onPressed: () => showModalBottomSheet(
|
||||||
@ -149,8 +159,10 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.vpn_key),
|
leading: const Icon(Icons.vpn_key),
|
||||||
title: Text(L10n.of(context)!.dehydrateTor),
|
title: Text(L10n.of(context)!.dehydrateTor),
|
||||||
subtitle: Text(L10n.of(context)!.dehydrateTorLong),
|
subtitle:
|
||||||
trailing: const Icon(Icons.chevron_right_outlined),
|
Text(L10n.of(context)!.dehydrateTorLong),
|
||||||
|
trailing:
|
||||||
|
const Icon(Icons.chevron_right_outlined),
|
||||||
onTap: controller.dehydrate,
|
onTap: controller.dehydrate,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -172,7 +184,9 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Divider(
|
Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: Theme.of(context).colorScheme.onBackground,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onBackground,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
FloatingActionButton.extended(
|
FloatingActionButton.extended(
|
||||||
@ -192,10 +206,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
if (!rooms[i]
|
if (!rooms[i].displayname.toLowerCase().contains(
|
||||||
.displayname
|
controller.searchController.text.toLowerCase())) {
|
||||||
.toLowerCase()
|
|
||||||
.contains(controller.searchController.text.toLowerCase())) {
|
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
return ChatListItem(
|
return ChatListItem(
|
||||||
|
@ -4,13 +4,11 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:badges/badges.dart';
|
import 'package:badges/badges.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
|
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
|
||||||
import 'package:vrouter/vrouter.dart';
|
import 'package:vrouter/vrouter.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
@ -105,21 +103,12 @@ class ChatListView extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: StreamBuilder<Object>(
|
child: Row(
|
||||||
key: ValueKey(client.userID.toString() +
|
|
||||||
controller.activeFilter.toString() +
|
|
||||||
controller.activeSpaceId.toString()),
|
|
||||||
stream: client.onSync.stream
|
|
||||||
.where((s) => s.hasRoomUpdate)
|
|
||||||
.rateLimit(const Duration(seconds: 1)),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
children: [
|
||||||
if (FluffyThemes.isColumnMode(context) &&
|
if (FluffyThemes.isColumnMode(context) &&
|
||||||
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
||||||
Builder(builder: (context) {
|
Builder(builder: (context) {
|
||||||
final allSpaces =
|
final allSpaces = client.rooms.where((room) => room.isSpace);
|
||||||
client.rooms.where((room) => room.isSpace);
|
|
||||||
final rootSpaces = allSpaces
|
final rootSpaces = allSpaces
|
||||||
.where(
|
.where(
|
||||||
(space) => !allSpaces.any(
|
(space) => !allSpaces.any(
|
||||||
@ -137,8 +126,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
itemCount: rootSpaces.length + destinations.length,
|
itemCount: rootSpaces.length + destinations.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
if (i < destinations.length) {
|
if (i < destinations.length) {
|
||||||
final isSelected =
|
final isSelected = i == controller.selectedIndex;
|
||||||
i == controller.selectedIndex;
|
|
||||||
return Container(
|
return Container(
|
||||||
height: 64,
|
height: 64,
|
||||||
width: 64,
|
width: 64,
|
||||||
@ -147,15 +135,12 @@ class ChatListView extends StatelessWidget {
|
|||||||
bottom: i == (destinations.length - 1)
|
bottom: i == (destinations.length - 1)
|
||||||
? BorderSide(
|
? BorderSide(
|
||||||
width: 1,
|
width: 1,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).dividerColor,
|
||||||
.dividerColor,
|
|
||||||
)
|
)
|
||||||
: BorderSide.none,
|
: BorderSide.none,
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context)
|
? Theme.of(context).colorScheme.primary
|
||||||
.colorScheme
|
|
||||||
.primary
|
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
@ -168,15 +153,11 @@ class ChatListView extends StatelessWidget {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context)
|
? Theme.of(context).colorScheme.secondary
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
: null,
|
: null,
|
||||||
icon: CircleAvatar(
|
icon: CircleAvatar(
|
||||||
backgroundColor: isSelected
|
backgroundColor: isSelected
|
||||||
? Theme.of(context)
|
? Theme.of(context).colorScheme.secondary
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.background,
|
.background,
|
||||||
@ -198,8 +179,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
i -= destinations.length;
|
i -= destinations.length;
|
||||||
final isSelected = controller.activeFilter ==
|
final isSelected =
|
||||||
ActiveFilter.spaces &&
|
controller.activeFilter == ActiveFilter.spaces &&
|
||||||
rootSpaces[i].id == controller.activeSpaceId;
|
rootSpaces[i].id == controller.activeSpaceId;
|
||||||
return Container(
|
return Container(
|
||||||
height: 64,
|
height: 64,
|
||||||
@ -208,9 +189,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context)
|
? Theme.of(context).colorScheme.secondary
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
@ -229,8 +208,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
size: 32,
|
size: 32,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
onPressed: () => controller
|
onPressed: () =>
|
||||||
.setActiveSpace(rootSpaces[i].id),
|
controller.setActiveSpace(rootSpaces[i].id),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -252,12 +231,10 @@ class ChatListView extends StatelessWidget {
|
|||||||
selectedIndex: controller.selectedIndex,
|
selectedIndex: controller.selectedIndex,
|
||||||
onDestinationSelected:
|
onDestinationSelected:
|
||||||
controller.onDestinationSelected,
|
controller.onDestinationSelected,
|
||||||
destinations:
|
destinations: getNavigationDestinations(context),
|
||||||
getNavigationDestinations(context),
|
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
floatingActionButton: controller
|
floatingActionButton: controller.filteredRooms.isNotEmpty &&
|
||||||
.filteredRooms.isNotEmpty &&
|
|
||||||
selectMode == SelectMode.normal
|
selectMode == SelectMode.normal
|
||||||
? KeyBoardShortcuts(
|
? KeyBoardShortcuts(
|
||||||
keysToPress: {
|
keysToPress: {
|
||||||
@ -274,8 +251,7 @@ class ChatListView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user