[Theme] Add initial dark theme
Took 1 hour 10 minutes
This commit is contained in:
parent
d7448320d9
commit
26ca8ba4ad
16 changed files with 577 additions and 111 deletions
|
|
@ -1,19 +1,17 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/views/sign_up.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:universal_html/prefer_universal/html.dart' as html;
|
||||
|
||||
import 'i18n/i18n.dart';
|
||||
import 'views/sign_up.dart';
|
||||
import 'components/ThemeSwitcher.dart';
|
||||
import 'components/matrix.dart';
|
||||
import 'views/chat_list.dart';
|
||||
|
||||
void main() {
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(statusBarColor: Colors.white),
|
||||
);
|
||||
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
|
||||
runApp(App());
|
||||
}
|
||||
|
||||
|
|
@ -23,63 +21,39 @@ class App extends StatelessWidget {
|
|||
return Matrix(
|
||||
clientName: "FluffyChat",
|
||||
child: Builder(
|
||||
builder: (BuildContext context) => MaterialApp(
|
||||
title: 'FluffyChat',
|
||||
theme: ThemeData(
|
||||
brightness: Brightness.light,
|
||||
primaryColor: Color(0xFF5625BA),
|
||||
backgroundColor: Colors.white,
|
||||
secondaryHeaderColor: Color(0xFFECECF2),
|
||||
scaffoldBackgroundColor: Colors.white,
|
||||
dialogTheme: DialogTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
builder: (BuildContext context) => ThemeSwitcherWidget(
|
||||
child: Builder(
|
||||
builder: (BuildContext context) => MaterialApp(
|
||||
title: 'FluffyChat',
|
||||
theme: ThemeSwitcherWidget.of(context).themeData,
|
||||
localizationsDelegates: [
|
||||
AppLocalizationsDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
const Locale('en'), // English
|
||||
const Locale('de'), // German
|
||||
],
|
||||
home: FutureBuilder<LoginState>(
|
||||
future:
|
||||
Matrix.of(context).client.onLoginStateChanged.stream.first,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (Matrix.of(context).client.isLogged()) {
|
||||
return ChatListView();
|
||||
}
|
||||
return SignUp();
|
||||
},
|
||||
),
|
||||
),
|
||||
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,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
),
|
||||
),
|
||||
localizationsDelegates: [
|
||||
AppLocalizationsDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
const Locale('en'), // English
|
||||
const Locale('de'), // German
|
||||
],
|
||||
locale: kIsWeb
|
||||
? Locale(html.window.navigator.language.split("-").first)
|
||||
: null,
|
||||
home: FutureBuilder<LoginState>(
|
||||
future: Matrix.of(context).client.onLoginStateChanged.stream.first,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (Matrix.of(context).client.isLogged()) return ChatListView();
|
||||
return SignUp();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue