theme test

This commit is contained in:
zoe 2022-07-02 19:32:44 +02:00
parent 061e12b285
commit 839bb0bbde
2 changed files with 21 additions and 3 deletions

View file

@ -5,15 +5,17 @@ import 'package:slothmu/partials/main_scaffold.dart';
import 'pages/login.dart';
import 'business_logic/settings.dart' as settings;
import 'package:flutter_localizations/flutter_localizations.dart';
import 'themes/themes.dart' as themes;
String initRoute = "/";
String _initRoute = "/";
void main() async {
Intl.defaultLocale = 'en_US';
// check if all information is available
settings.saveAuthCode("");
if (await settings.loadAuthCode() == "") {
initRoute = "/login";
_initRoute = "/login";
}
runApp(const Slothmu());
}
@ -34,6 +36,7 @@ class _SlothmuState extends State<Slothmu> {
Widget build(BuildContext context) {
LocalJsonLocalization.delegate.directories = ['lib/i18n'];
return MaterialApp(
theme: themes.defaultThemeDark,
supportedLocales: supported,
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
@ -41,7 +44,7 @@ class _SlothmuState extends State<Slothmu> {
GlobalMaterialLocalizations.delegate,
LocalJsonLocalization.delegate,
],
initialRoute: initRoute,
initialRoute: _initRoute,
routes: {
'/': (context) => const MainScaffold(),
'/login': (context) => const Login(),

15
lib/themes/themes.dart Normal file
View file

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
final defaultThemeDark = ThemeData(
colorScheme: const ColorScheme(
brightness: Brightness.dark,
primary: Colors.white,
onPrimary: Colors.black,
secondary: Colors.lime,
onSecondary: Colors.black,
error: Colors.red,
onError: Colors.white,
background: Colors.black,
onBackground: Colors.white,
surface: Colors.deepPurple,
onSurface: Colors.white));