fix: Chat list flickering

This commit is contained in:
Krille Fear 2021-11-09 17:30:04 +01:00
parent bda4727490
commit 3342071acf
2 changed files with 6 additions and 3 deletions

View File

@ -166,9 +166,10 @@ class ChatListController extends State<ChatList> {
void initState() {
_initReceiveSharingIntent();
WidgetsBinding.instance.addPostFrameCallback(
(_) => waitForFirstSync().then((_) => checkBootstrap()),
(_) => waitForFirstSync.then((_) => checkBootstrap()),
);
scrollController.addListener(_onScroll);
waitForFirstSync = _waitForFirstSync();
super.initState();
}
@ -384,7 +385,9 @@ class ChatListController extends State<ChatList> {
setState(() => selectedRoomIds.clear());
}
Future<void> waitForFirstSync() async {
Future<void> waitForFirstSync;
Future<void> _waitForFirstSync() async {
final client = Matrix.of(context).client;
await client.roomsLoading;
await client.accountDataLoading;

View File

@ -430,7 +430,7 @@ class _ChatListViewBody extends StatelessWidget {
.rateLimit(const Duration(seconds: 1)),
builder: (context, snapshot) {
return FutureBuilder<void>(
future: controller.waitForFirstSync(),
future: controller.waitForFirstSync,
builder: (BuildContext context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final rooms = Matrix.of(context)