2
0
mirror of https://gitlab.com/famedly/fluffychat.git synced 2024-12-22 13:32:37 +01:00
fluffychat/lib/widgets/layouts/loading_view.dart
2021-10-26 18:50:34 +02:00

33 lines
932 B
Dart

import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/pages/views/empty_page_view.dart';
import 'package:fluffychat/widgets/matrix.dart';
class LoadingView extends StatelessWidget {
const LoadingView({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
if (Matrix.of(context)
.widget
.clients
.every((client) => client.loginState != null)) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => VRouter.of(context).to(
Matrix.of(context)
.widget
.clients
.any((client) => client.loginState == LoginState.loggedIn)
? '/rooms'
: '/home',
queryParameters: VRouter.of(context).queryParameters,
),
);
}
return const EmptyPage(loading: true);
}
}