forked from pndaza/tipitaka-pali
-
Notifications
You must be signed in to change notification settings - Fork 6
/
change_theme_widget.dart
28 lines (24 loc) · 918 Bytes
/
change_theme_widget.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import 'package:tipitaka_pali/services/provider/theme_change_notifier.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tipitaka_pali/services/prefs.dart';
class ChangeThemeWidget extends StatelessWidget {
const ChangeThemeWidget({super.key});
@override
Widget build(BuildContext context) {
//final themeProvider = Provider.of<ThemeChangeNotifier>(context);
// This code is not used.. old code
// now use 3 state button
return Switch(
value: Prefs.darkThemeOn,
activeThumbImage: const AssetImage("assets/sun.png"),
inactiveThumbImage: const AssetImage("assets/moon.png"),
onChanged: (value) {
final provider =
Provider.of<ThemeChangeNotifier>(context, listen: false);
Prefs.darkThemeOn = value;
provider.toggleTheme(Prefs.selectedPageColor); // not used.. old cod
},
);
}
}