mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-23 22:12:34 +01:00
design: Nicer loading screen and empty page
This commit is contained in:
parent
9c5a590ee7
commit
def075aa8c
BIN
assets/info-logo.png
Normal file
BIN
assets/info-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -1,12 +1,36 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EmptyPage extends StatelessWidget {
|
||||
const EmptyPage({Key key}) : super(key: key);
|
||||
final bool loading;
|
||||
static const double _width = 200;
|
||||
const EmptyPage({this.loading = false, Key key}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _width = min(MediaQuery.of(context).size.width, EmptyPage._width);
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Image.asset('assets/favicon.png', width: 100, height: 100),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Hero(
|
||||
tag: 'info-logo',
|
||||
child: Image.asset(
|
||||
'assets/info-logo.png',
|
||||
width: _width,
|
||||
height: _width,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (loading)
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: _width,
|
||||
child: LinearProgressIndicator(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:fluffychat/pages/views/empty_page_view.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:vrouter/vrouter.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
@ -16,6 +17,6 @@ class LoadingView extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
return Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
return EmptyPage(loading: true);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:fluffychat/pages/views/empty_page_view.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -14,7 +15,7 @@ class WaitForInitPage extends StatelessWidget {
|
||||
stream: Matrix.of(context).client.onLoginStateChanged.stream,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
return EmptyPage(loading: true);
|
||||
}
|
||||
return page;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user