FurryChat/lib/main.dart

69 lines
2 KiB
Dart
Raw Normal View History

2020-01-01 18:10:13 +00:00
import 'package:famedlysdk/famedlysdk.dart';
2020-01-09 21:52:27 +00:00
import 'package:fluffychat/views/sign_up.dart';
2020-01-01 18:10:13 +00:00
import 'package:flutter/material.dart';
2020-01-02 21:31:39 +00:00
import 'package:flutter/services.dart';
2020-01-01 18:10:13 +00:00
import 'components/matrix.dart';
import 'views/chat_list.dart';
2020-01-02 21:31:39 +00:00
void main() {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.white),
);
runApp(App());
}
2020-01-01 18:10:13 +00:00
2020-01-02 21:31:39 +00:00
class App extends StatelessWidget {
2020-01-01 18:10:13 +00:00
@override
Widget build(BuildContext context) {
return Matrix(
clientName: "FluffyChat",
2020-01-01 18:10:13 +00:00
child: MaterialApp(
title: 'FluffyChat',
2020-01-01 18:10:13 +00:00
theme: ThemeData(
2020-01-03 10:47:31 +00:00
brightness: Brightness.light,
2020-01-01 18:10:13 +00:00
primaryColor: Color(0xFF5625BA),
backgroundColor: Colors.white,
2020-01-17 09:39:46 +00:00
secondaryHeaderColor: Color(0xFFF0F0F0),
2020-01-01 18:10:13 +00:00
scaffoldBackgroundColor: Colors.white,
dialogTheme: DialogTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
appBarTheme: AppBarTheme(
2020-01-03 10:47:31 +00:00
brightness: Brightness.light,
2020-01-01 18:10:13 +00:00
color: Colors.white,
elevation: 1,
textTheme: TextTheme(
title: TextStyle(color: Colors.black),
),
iconTheme: IconThemeData(color: Colors.black),
),
),
home: Builder(
2020-01-08 13:19:15 +00:00
builder: (BuildContext context) => FutureBuilder<LoginState>(
future: Matrix.of(context).client.onLoginStateChanged.stream.first,
2020-01-01 18:10:13 +00:00
builder: (context, snapshot) {
2020-01-02 21:31:39 +00:00
if (!snapshot.hasData) {
2020-01-01 18:10:13 +00:00
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
2020-01-02 21:31:39 +00:00
}
2020-01-01 18:10:13 +00:00
if (Matrix.of(context).client.isLogged()) return ChatListView();
2020-01-09 21:52:27 +00:00
return SignUp();
2020-01-01 18:10:13 +00:00
},
),
),
),
);
}
}