Files
como-gasto/lib/states/theme_state.dart
T
2020-01-21 12:44:09 -03:00

27 lines
714 B
Dart

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();
}
}