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