@@ -7,7 +7,6 @@ class GameSettingsTablet extends StatelessWidget {
77 @override
88 Widget build (BuildContext context) {
99 final scheme = Theme .of (context).colorScheme;
10- final settingsState = gameSettingsViewStateKey.currentState;
1110 return DefaultTabController (
1211 length: 2 ,
1312 child: Scaffold (
@@ -23,39 +22,46 @@ class GameSettingsTablet extends StatelessWidget {
2322 child: Padding (
2423 padding:
2524 const EdgeInsets .only (left: 24 , right: 24 , top: 24 ),
26- child: Column (
27- crossAxisAlignment: CrossAxisAlignment .center,
28- children: [
29- AppBarSettings (label: GameSettingConsts .appBarLabel),
30- CustomTabBar (
31- initialIndex: settingsState! .withoutTime ? 0 : 1 ,
32- header: GameSettingConsts .timeText,
33- subTitles: [
34- GameSettingConsts .gameWithoutTimeText,
35- GameSettingConsts .gameWithTimeText,
25+ child: Consumer <GameSettingsProvider >(
26+ builder: (_, settingsProvider, __) {
27+ return Column (
28+ crossAxisAlignment: CrossAxisAlignment .center,
29+ children: [
30+ AppBarSettings (
31+ label: GameSettingConsts .appBarLabel),
32+ CustomTabBar (
33+ initialIndex:
34+ settingsProvider.withoutTime ? 0 : 1 ,
35+ header: GameSettingConsts .timeText,
36+ subTitles: [
37+ GameSettingConsts .gameWithoutTimeText,
38+ GameSettingConsts .gameWithTimeText,
39+ ],
40+ isSettingsPage: true ,
41+ onTap: (dynamic index) =>
42+ settingsProvider.setIsTime (index as int ),
43+ ),
44+ if (! settingsProvider.withoutTime) ...[
45+ const SizedBox (height: 70 ),
46+ SetTimeSection (
47+ minutesStartValue:
48+ settingsProvider.durationOfGame,
49+ minutesOnChanged: (dynamic value) =>
50+ settingsProvider.setMinutes (value as int ),
51+ secondsStartValue:
52+ settingsProvider.addingOfMove == 0
53+ ? GameSettingConsts .longDashSymbol
54+ : settingsProvider.addingOfMove,
55+ secondsOnChanged: (dynamic value) =>
56+ settingsProvider.setSeconds (value as int ),
57+ )
58+ ],
59+ const SizedBox (height: 120 ),
60+ const SettingsRowsSection (),
61+ const SizedBox (height: 100 ),
3662 ],
37- isSettingsPage: true ,
38- onTap: (dynamic index) => gameSettingsViewStateKey
39- .currentState
40- ? .setIsTime (index as int ),
41- ),
42- if (! settingsState.withoutTime) ...[
43- const SizedBox (height: 70 ),
44- SetTimeSection (
45- minutesStartValue: settingsState.durationOfGame,
46- minutesOnChanged: (dynamic value) =>
47- settingsState.setMinutes (value as int ),
48- secondsStartValue: settingsState.addingOfMove == 0
49- ? GameSettingConsts .longDashSymbol
50- : settingsState.addingOfMove,
51- secondsOnChanged: (dynamic value) =>
52- settingsState.setSeconds (value as int ),
53- )
54- ],
55- const SizedBox (height: 120 ),
56- const SettingsRowsSection (),
57- const SizedBox (height: 100 ),
58- ],
63+ );
64+ },
5965 ),
6066 ),
6167 ),
@@ -76,7 +82,9 @@ class GameSettingsTablet extends StatelessWidget {
7682 textColor: ColorsConst .primaryColor0,
7783 buttonColor: scheme.secondaryContainer,
7884 isClickable: true ,
79- onTap: () => settingsState.handleStartGame (context),
85+ onTap: () => context
86+ .read <GameSettingsProvider >()
87+ .handleStartGame (context),
8088 ),
8189 ),
8290 ),
0 commit comments