mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
21 lines
534 B
Dart
21 lines
534 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
var themeProvider = ChangeNotifierProvider((ref) => ThemeViewModel());
|
|
|
|
class ThemeViewModel extends ChangeNotifier {
|
|
ThemeData currentTheme = lightTheme;
|
|
|
|
void changeTheme() {
|
|
if (currentTheme == darkTheme) {
|
|
currentTheme = lightTheme;
|
|
} else {
|
|
currentTheme = darkTheme;
|
|
}
|
|
notifyListeners();
|
|
}
|
|
}
|
|
|
|
ThemeData darkTheme = ThemeData.dark().copyWith();
|
|
ThemeData lightTheme = ThemeData.light().copyWith();
|