Created
March 9, 2020 20:14
-
-
Save Ahmadre/e318acc506b01553af22187855110bfe to your computer and use it in GitHub Desktop.
Segmentation fault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:luitsapp/Screens/splashScreen.dart'; | |
import 'package:luitsapp/services/hive/credentialsManager.dart'; | |
import 'package:tinycolor/tinycolor.dart'; | |
void main() async { | |
runApp(LUITSApp()); | |
} | |
class LUITSApp extends StatefulWidget { | |
static Function switchBrightness; | |
@override | |
_LUITSAppState createState() => _LUITSAppState(); | |
} | |
class _LUITSAppState extends State<LUITSApp> { | |
String appBrightness = AppBrightness.system; | |
@override | |
void initState() { | |
super.initState(); | |
LUITSApp.switchBrightness = switchBrightness; | |
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { | |
this.appBrightness = await CredentialsManager().appBrightness(); | |
setState(() {}); | |
}); | |
} | |
Future<void> switchBrightness() async { | |
this.appBrightness = await CredentialsManager().appBrightness(); | |
setState(() {}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
themeMode: appBrightness == AppBrightness.light | |
? ThemeMode.light | |
: appBrightness == AppBrightness.dark | |
? ThemeMode.dark | |
: ThemeMode.system, | |
darkTheme: ThemeData( | |
fontFamily: 'Calibri_Regular', | |
brightness: Brightness.dark, | |
primaryColor: TinyColor.fromString('#93bed1').darken(30).color, | |
accentColor: TinyColor(Color(0xff1ab2fe)).darken(20).color, | |
primarySwatch: Theme.of(context).primaryColor, | |
accentIconTheme: IconThemeData().copyWith(color: Colors.white), | |
primaryIconTheme: IconTheme.of(context).copyWith(color: Colors.white), | |
primaryTextTheme: | |
TextTheme().copyWith(headline6: TextStyle(color: Colors.white))), | |
debugShowCheckedModeBanner: false, | |
title: 'LUITS', | |
theme: ThemeData( | |
backgroundColor: Colors.white, | |
fontFamily: 'Calibri_Regular', | |
brightness: Brightness.light, | |
primaryColor: TinyColor.fromString('#93bed1').darken().color, | |
accentColor: TinyColor(Color(0xff1ab2fe)).darken().color, | |
primarySwatch: Theme.of(context).primaryColor, | |
primaryIconTheme: IconTheme.of(context).copyWith(color: Colors.black), | |
primaryTextTheme: | |
TextTheme().copyWith(headline6: TextStyle(color: Colors.black))), | |
home: SplashScreen(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment