@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
22import 'package:flutter_bloc/flutter_bloc.dart' ;
33import 'package:flutter_bloc_app_template/bloc/theme/app_theme.dart' ;
44import 'package:flutter_bloc_app_template/index.dart' ;
5- import 'package:flutter_bloc_app_template/utils/pair.dart' ;
65
76class DarkThemeScreen extends StatelessWidget {
87 const DarkThemeScreen ({super .key});
@@ -16,42 +15,52 @@ class DarkThemeScreen extends StatelessWidget {
1615 body: ListView (children: < Widget > [
1716 BlocConsumer <ThemeCubit , AppThemeSettings >(
1817 builder: (context, state) {
19- return Column (
20- children: [
21- ...[
22- Pair (
23- DarkThemePreference .on ,
24- context.darkThemeOnSettingsItemTitle,
18+ return RadioGroup <int >(
19+ groupValue: state.darkTheme.darkThemeValue,
20+ onChanged: (int ? value) {
21+ context.read <ThemeCubit >().updateTheme (
22+ state.copyWith (
23+ darkTheme: state.darkTheme.copyWith (
24+ darkThemeValue: value,
25+ ),
26+ ),
27+ );
28+ },
29+ child: Column (
30+ children: < Widget > [
31+ RadioListTile <int >(
32+ title: Text (context.darkThemeOnSettingsItemTitle),
33+ value: DarkThemePreference .on ,
34+ key: Key (context.darkThemeOnSettingsItemTitle),
35+ secondary: ThemeIcon (
36+ icon: themeIcon (DarkThemePreference .on ),
37+ isSelected: DarkThemePreference .on ==
38+ state.darkTheme.darkThemeValue,
39+ ),
2540 ),
26- Pair (
27- DarkThemePreference .off,
28- context.darkThemeOffSettingsItemTitle,
41+ RadioListTile <int >(
42+ title: Text (context.darkThemeOffSettingsItemTitle),
43+ value: DarkThemePreference .off,
44+ key: Key (context.darkThemeOffSettingsItemTitle),
45+ secondary: ThemeIcon (
46+ icon: themeIcon (DarkThemePreference .off),
47+ isSelected: DarkThemePreference .off ==
48+ state.darkTheme.darkThemeValue,
49+ ),
2950 ),
30- Pair (
31- DarkThemePreference .followSystem,
32- context.darkThemeFollowSystemSettingsItemTitle,
51+ RadioListTile <int >(
52+ title: Text (context.darkThemeFollowSystemSettingsItemTitle),
53+ value: DarkThemePreference .followSystem,
54+ key: Key (context.darkThemeFollowSystemSettingsItemTitle),
55+ secondary: ThemeIcon (
56+ icon: themeIcon (DarkThemePreference .followSystem),
57+ isSelected: DarkThemePreference .followSystem ==
58+ state.darkTheme.darkThemeValue,
59+ ),
3360 ),
34- ].map ((elem) => RadioListTile <int >(
35- title: Text (elem.second),
36- value: elem.first,
37- key: Key (elem.second),
38- groupValue: state.darkTheme.darkThemeValue,
39- onChanged: (value) {
40- context.read <ThemeCubit >().updateTheme (
41- state.copyWith (
42- darkTheme: state.darkTheme.copyWith (
43- darkThemeValue: value,
44- ),
45- ),
46- );
47- },
48- secondary: ThemeIcon (
49- icon: themeIcon (elem.first),
50- isSelected:
51- elem.first == state.darkTheme.darkThemeValue,
52- ),
53- ))
54- ],
61+ //Radio<int>(value: DarkThemePreference.off),
62+ ],
63+ ),
5564 );
5665 },
5766 listener: (context, state) => {},
0 commit comments