mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-13 23:49:29 +01:00
69 lines
2.0 KiB
Dart
69 lines
2.0 KiB
Dart
import 'package:famedlysdk/famedlysdk.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'components/matrix.dart';
|
|
import 'views/chat_list.dart';
|
|
import 'views/login.dart';
|
|
|
|
void main() {
|
|
SystemChrome.setSystemUIOverlayStyle(
|
|
SystemUiOverlayStyle(statusBarColor: Colors.white),
|
|
);
|
|
runApp(App());
|
|
}
|
|
|
|
class App extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Matrix(
|
|
clientName: "FluffyWeb",
|
|
child: MaterialApp(
|
|
title: 'FluffyWeb',
|
|
theme: ThemeData(
|
|
brightness: Brightness.light,
|
|
primaryColor: Color(0xFF5625BA),
|
|
backgroundColor: Colors.white,
|
|
secondaryHeaderColor: Color(0xFFF2F2F2),
|
|
scaffoldBackgroundColor: Colors.white,
|
|
dialogTheme: DialogTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
popupMenuTheme: PopupMenuThemeData(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
appBarTheme: AppBarTheme(
|
|
brightness: Brightness.light,
|
|
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,
|
|
builder: (context, snapshot) {
|
|
if (!snapshot.hasData) {
|
|
return Scaffold(
|
|
body: Center(
|
|
child: CircularProgressIndicator(),
|
|
),
|
|
);
|
|
}
|
|
if (Matrix.of(context).client.isLogged()) return ChatListView();
|
|
return LoginPage();
|
|
},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|