Add theme switcher

This commit is contained in:
Ricardo Markiewicz
2020-01-21 12:44:09 -03:00
parent a05d2a8f48
commit d181afb606
21 changed files with 697 additions and 295 deletions
+26
View File
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
class ThemeState with ChangeNotifier {
bool _isDarkModeEnabled = false;
ThemeData get currentTheme => _isDarkModeEnabled
? ThemeData.dark().copyWith(
accentColor: Colors.red,
buttonTheme: ButtonThemeData(
buttonColor: Colors.red,
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
),
toggleableActiveColor: Colors.red,
)
: ThemeData.light();
bool get isDarkModeEnabled => _isDarkModeEnabled;
void setDarkMode(bool b) {
_isDarkModeEnabled = b;
notifyListeners();
}
}