Skip to content

Instantly share code, notes, and snippets.

@RodBr
Created May 18, 2020 02:45
Show Gist options
  • Save RodBr/c11d55977021be08a037fd394f682a21 to your computer and use it in GitHub Desktop.
Save RodBr/c11d55977021be08a037fd394f682a21 to your computer and use it in GitHub Desktop.
Themes in 3 lines
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