2021-10-26 18:50:34 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2021-06-18 10:29:48 +02:00
|
|
|
import 'package:matrix/matrix.dart';
|
2021-05-23 13:11:55 +02:00
|
|
|
import 'package:vrouter/vrouter.dart';
|
2021-10-26 18:50:34 +02:00
|
|
|
|
2022-07-15 16:39:28 +02:00
|
|
|
import 'package:fluffychat/utils/update_checker_no_store.dart';
|
2021-11-09 21:32:16 +01:00
|
|
|
import 'package:fluffychat/widgets/layouts/empty_page.dart';
|
2021-05-22 08:53:52 +02:00
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
2021-01-16 12:46:38 +01:00
|
|
|
|
|
|
|
class LoadingView extends StatelessWidget {
|
2021-11-19 20:28:17 +01:00
|
|
|
const LoadingView({Key? key}) : super(key: key);
|
2021-10-14 18:09:30 +02:00
|
|
|
|
2021-01-16 12:46:38 +01:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-05-12 11:25:34 +02:00
|
|
|
WidgetsBinding.instance.addPostFrameCallback(
|
2022-07-15 16:39:28 +02:00
|
|
|
(_) async {
|
|
|
|
await UpdateCheckerNoStore(context).checkUpdate();
|
|
|
|
VRouter.of(context).to(
|
2023-03-02 10:57:52 +01:00
|
|
|
Matrix.of(context).widget.clients.any(
|
|
|
|
(client) =>
|
|
|
|
client.onLoginStateChanged.value == LoginState.loggedIn,
|
|
|
|
)
|
2022-07-15 16:39:28 +02:00
|
|
|
? '/rooms'
|
|
|
|
: '/home',
|
|
|
|
queryParameters: VRouter.of(context).queryParameters,
|
|
|
|
);
|
|
|
|
},
|
2021-11-19 20:28:17 +01:00
|
|
|
);
|
2021-10-14 18:09:30 +02:00
|
|
|
return const EmptyPage(loading: true);
|
2021-01-16 12:46:38 +01:00
|
|
|
}
|
|
|
|
}
|