fix: re-enable chat list animation

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-12-25 18:33:06 +01:00
parent 7cdeb98671
commit 478634cb99

View File

@ -17,6 +17,7 @@ import '../../widgets/connection_status_header.dart';
import '../../widgets/matrix.dart';
class ChatListViewBody extends StatelessWidget {
static final _transitionSwitcherKey = GlobalKey();
final ChatListController controller;
const ChatListViewBody(this.controller, {Key? key}) : super(key: key);
@ -28,6 +29,7 @@ class ChatListViewBody extends StatelessWidget {
final client = Matrix.of(context).client;
return PageTransitionSwitcher(
key: _transitionSwitcherKey,
transitionBuilder: (
Widget child,
Animation<double> primaryAnimation,
@ -41,13 +43,18 @@ class ChatListViewBody extends StatelessWidget {
child: child,
);
},
child: Builder(builder: (context) {
child: Builder(
key: ValueKey(
controller.activeFilter != ActiveFilter.spaces
? controller.activeFilter
: controller.activeSpaceId ?? controller.activeFilter,
),
builder: (context) {
if (controller.activeFilter == ActiveFilter.spaces &&
!controller.isSearchMode) {
return SpaceView(
controller,
scrollController: controller.scrollController,
key: Key(controller.activeSpaceId ?? 'Spaces'),
);
}
if (controller.waitForFirstSync && client.prevBatch != null) {
@ -87,8 +94,8 @@ class ChatListViewBody extends StatelessWidget {
onPressed: () => showModalBottomSheet(
context: context,
builder: (c) => PublicRoomBottomSheet(
roomAlias:
roomSearchResult.chunk[i].canonicalAlias ??
roomAlias: roomSearchResult
.chunk[i].canonicalAlias ??
roomSearchResult.chunk[i].roomId,
outerContext: context,
chunk: roomSearchResult.chunk[i],
@ -113,7 +120,8 @@ class ChatListViewBody extends StatelessWidget {
itemCount: userSearchResult.results.length,
itemBuilder: (context, i) => _SearchItem(
title: userSearchResult.results[i].displayName ??
userSearchResult.results[i].userId.localpart ??
userSearchResult
.results[i].userId.localpart ??
L10n.of(context)!.unknownDevice,
avatar: userSearchResult.results[i].avatarUrl,
onPressed: () => showModalBottomSheet(
@ -172,7 +180,8 @@ class ChatListViewBody extends StatelessWidget {
),
Divider(
height: 1,
color: Theme.of(context).colorScheme.onBackground,
color:
Theme.of(context).colorScheme.onBackground,
),
const SizedBox(height: 32),
FloatingActionButton.extended(
@ -217,7 +226,6 @@ class ChatListViewBody extends StatelessWidget {
final subtitleColor =
Theme.of(context).textTheme.bodyText1!.color!.withAlpha(50);
return ListView.builder(
key: const Key('dummychats'),
itemCount: dummyChatCount,
itemBuilder: (context, i) => Opacity(
opacity: (dummyChatCount - i) / dummyChatCount,
@ -271,7 +279,8 @@ class ChatListViewBody extends StatelessWidget {
),
),
);
}),
},
),
);
}
}