2021-06-20 09:31:22 +02:00
|
|
|
import 'package:fluffychat/pages/views/empty_page_view.dart';
|
2021-06-18 10:29:48 +02:00
|
|
|
import 'package:matrix/matrix.dart';
|
2021-06-10 10:20:00 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import '../matrix.dart';
|
|
|
|
|
|
|
|
class WaitForInitPage extends StatelessWidget {
|
|
|
|
final Widget page;
|
|
|
|
const WaitForInitPage(this.page, {Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
if (Matrix.of(context).loginState == null) {
|
|
|
|
return StreamBuilder<LoginState>(
|
|
|
|
stream: Matrix.of(context).client.onLoginStateChanged.stream,
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
if (!snapshot.hasData) {
|
2021-06-20 09:31:22 +02:00
|
|
|
return EmptyPage(loading: true);
|
2021-06-10 10:20:00 +02:00
|
|
|
}
|
|
|
|
return page;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return page;
|
|
|
|
}
|
|
|
|
}
|