mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
26 lines
647 B
Dart
26 lines
647 B
Dart
import 'package:flutter/cupertino.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(
|
|
primaryColor: Color(0xffffffff),
|
|
);
|
|
ThemeData lightTheme = ThemeData.light().copyWith(
|
|
primaryColor: Color(0xFF0F77FE),
|
|
);
|