theme test
This commit is contained in:
		
							parent
							
								
									061e12b285
								
							
						
					
					
						commit
						839bb0bbde
					
				
					 2 changed files with 21 additions and 3 deletions
				
			
		|  | @ -5,15 +5,17 @@ import 'package:slothmu/partials/main_scaffold.dart'; | ||||||
| import 'pages/login.dart'; | import 'pages/login.dart'; | ||||||
| import 'business_logic/settings.dart' as settings; | import 'business_logic/settings.dart' as settings; | ||||||
| import 'package:flutter_localizations/flutter_localizations.dart'; | import 'package:flutter_localizations/flutter_localizations.dart'; | ||||||
|  | import 'themes/themes.dart' as themes; | ||||||
| 
 | 
 | ||||||
| String initRoute = "/"; | String _initRoute = "/"; | ||||||
| 
 | 
 | ||||||
| void main() async { | void main() async { | ||||||
|   Intl.defaultLocale = 'en_US'; |   Intl.defaultLocale = 'en_US'; | ||||||
| 
 | 
 | ||||||
|   // check if all information is available |   // check if all information is available | ||||||
|  |   settings.saveAuthCode(""); | ||||||
|   if (await settings.loadAuthCode() == "") { |   if (await settings.loadAuthCode() == "") { | ||||||
|     initRoute = "/login"; |     _initRoute = "/login"; | ||||||
|   } |   } | ||||||
|   runApp(const Slothmu()); |   runApp(const Slothmu()); | ||||||
| } | } | ||||||
|  | @ -34,6 +36,7 @@ class _SlothmuState extends State<Slothmu> { | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     LocalJsonLocalization.delegate.directories = ['lib/i18n']; |     LocalJsonLocalization.delegate.directories = ['lib/i18n']; | ||||||
|     return MaterialApp( |     return MaterialApp( | ||||||
|  |       theme: themes.defaultThemeDark, | ||||||
|       supportedLocales: supported, |       supportedLocales: supported, | ||||||
|       localizationsDelegates: [ |       localizationsDelegates: [ | ||||||
|         GlobalCupertinoLocalizations.delegate, |         GlobalCupertinoLocalizations.delegate, | ||||||
|  | @ -41,7 +44,7 @@ class _SlothmuState extends State<Slothmu> { | ||||||
|         GlobalMaterialLocalizations.delegate, |         GlobalMaterialLocalizations.delegate, | ||||||
|         LocalJsonLocalization.delegate, |         LocalJsonLocalization.delegate, | ||||||
|       ], |       ], | ||||||
|       initialRoute: initRoute, |       initialRoute: _initRoute, | ||||||
|       routes: { |       routes: { | ||||||
|         '/': (context) => const MainScaffold(), |         '/': (context) => const MainScaffold(), | ||||||
|         '/login': (context) => const Login(), |         '/login': (context) => const Login(), | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								lib/themes/themes.dart
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								lib/themes/themes.dart
									
										
									
									
									
										Normal 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)); | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue