Created
May 18, 2020 02:45
-
-
Save RodBr/c11d55977021be08a037fd394f682a21 to your computer and use it in GitHub Desktop.
Themes in 3 lines
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
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
//STEP 2 - replace MaterialApp with GetMaterialApp | |
return GetMaterialApp( | |
title: 'Theme change using Get', | |
theme: ThemeData.light().copyWith(primaryColor: Colors.green), | |
darkTheme: ThemeData.dark().copyWith(primaryColor: Colors.purple), | |
// NOTE: Optional - use themeMode to specify the startup theme | |
themeMode: ThemeMode.system, | |
home: MyHomePage(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment