fluffychat/lib/widgets/layouts/loading_view.dart

22 lines
677 B
Dart
Raw Normal View History

import 'package:matrix/matrix.dart';
2021-05-23 13:11:55 +02:00
import 'package:vrouter/vrouter.dart';
2021-05-22 08:53:52 +02:00
import 'package:fluffychat/widgets/matrix.dart';
2021-01-16 12:46:38 +01:00
import 'package:flutter/material.dart';
class LoadingView extends StatelessWidget {
@override
Widget build(BuildContext context) {
2021-01-17 08:05:34 +01:00
if (Matrix.of(context).loginState != null) {
2021-06-18 16:15:11 +02:00
WidgetsBinding.instance.addPostFrameCallback(
(_) => context.vRouter.push(
2021-05-23 13:11:55 +02:00
Matrix.of(context).loginState == LoginState.logged
? '/rooms'
2021-06-18 16:15:11 +02:00
: '/home',
queryParameters: VRouter.of(context).queryParameters,
),
);
2021-01-17 08:05:34 +01:00
}
2021-01-18 08:38:19 +01:00
return Scaffold(body: Center(child: CircularProgressIndicator()));
2021-01-16 12:46:38 +01:00
}
}