You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/main.dart

69 lines
2.0 KiB
Dart

5 years ago
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
5 years ago
import 'package:flutter/services.dart';
5 years ago
import 'components/matrix.dart';
import 'views/chat_list.dart';
import 'views/login.dart';
5 years ago
void main() {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.white),
);
runApp(App());
}
5 years ago
5 years ago
class App extends StatelessWidget {
5 years ago
@override
Widget build(BuildContext context) {
return Matrix(
clientName: "FluffyWeb",
child: MaterialApp(
title: 'FluffyWeb',
theme: ThemeData(
5 years ago
brightness: Brightness.light,
5 years ago
primaryColor: Color(0xFF5625BA),
backgroundColor: Colors.white,
secondaryHeaderColor: Color(0xFFF2F2F2),
5 years ago
scaffoldBackgroundColor: Colors.white,
dialogTheme: DialogTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
appBarTheme: AppBarTheme(
5 years ago
brightness: Brightness.light,
5 years ago
color: Colors.white,
elevation: 1,
textTheme: TextTheme(
title: TextStyle(color: Colors.black),
),
iconTheme: IconThemeData(color: Colors.black),
),
),
home: Builder(
builder: (BuildContext context) => StreamBuilder<LoginState>(
stream: Matrix.of(context).client.onLoginStateChanged.stream,
5 years ago
builder: (context, snapshot) {
5 years ago
if (!snapshot.hasData) {
5 years ago
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
5 years ago
}
5 years ago
if (Matrix.of(context).client.isLogged()) return ChatListView();
return LoginPage();
},
),
),
),
);
}
}