@@ -40,176 +40,210 @@ class CreateGameWidget extends ConsumerWidget {
4040 mainAxisAlignment: MainAxisAlignment .spaceBetween,
4141 children: [
4242 Expanded (
43- child: Column (
44- crossAxisAlignment: CrossAxisAlignment .stretch,
45- mainAxisSize: MainAxisSize .min,
46- children: [
47- Text (context.l10n.timeControl, style: labelStyle),
48- OutlinedButton .icon (
49- style: OutlinedButton .styleFrom (
50- side: BorderSide (color: Theme .of (context).dividerColor),
51- ),
52- icon: Icon (playPrefs.timeIncrement.speed.icon),
53- label: Text (
54- playPrefs.timeIncrement.display,
55- style: const TextStyle (letterSpacing: 2.0 ),
43+ child: Semantics (
44+ container: true ,
45+ button: true ,
46+ label: '${context .l10n .timeControl }: ${playPrefs .timeIncrement .display }' ,
47+ excludeSemantics: true ,
48+ child: Column (
49+ crossAxisAlignment: CrossAxisAlignment .stretch,
50+ mainAxisSize: MainAxisSize .min,
51+ children: [
52+ Text (context.l10n.timeControl, style: labelStyle),
53+ OutlinedButton .icon (
54+ style: OutlinedButton .styleFrom (
55+ side: BorderSide (color: Theme .of (context).dividerColor),
56+ ),
57+ icon: Icon (playPrefs.timeIncrement.speed.icon),
58+ label: Text (
59+ playPrefs.timeIncrement.display,
60+ style: const TextStyle (letterSpacing: 2.0 ),
61+ ),
62+ onPressed: () {
63+ final double screenHeight = MediaQuery .heightOf (context);
64+ showModalBottomSheet <void >(
65+ context: context,
66+ isScrollControlled: true ,
67+ constraints: BoxConstraints (
68+ maxHeight: screenHeight - (screenHeight / 10 ),
69+ ),
70+ builder: (BuildContext context) {
71+ return TimeControlModal (
72+ timeIncrement: playPrefs.timeIncrement,
73+ onSelected: (choice) {
74+ ref
75+ .read (gameSetupPreferencesProvider.notifier)
76+ .setTimeIncrement (choice);
77+ },
78+ );
79+ },
80+ );
81+ },
5682 ),
57- onPressed: () {
58- final double screenHeight = MediaQuery .heightOf (context);
59- showModalBottomSheet <void >(
60- context: context,
61- isScrollControlled: true ,
62- constraints: BoxConstraints (maxHeight: screenHeight - (screenHeight / 10 )),
63- builder: (BuildContext context) {
64- return TimeControlModal (
65- timeIncrement: playPrefs.timeIncrement,
66- onSelected: (choice) {
67- ref
68- .read (gameSetupPreferencesProvider.notifier)
69- .setTimeIncrement (choice);
70- },
71- );
72- },
73- );
74- },
75- ),
76- ],
83+ ],
84+ ),
7785 ),
7886 ),
7987 const SizedBox (width: 8.0 ),
8088 Expanded (
81- child: Column (
82- crossAxisAlignment: CrossAxisAlignment .stretch,
83- mainAxisSize: MainAxisSize .min,
84- children: [
85- Text (context.l10n.variant, style: labelStyle),
86- OutlinedButton .icon (
87- style: OutlinedButton .styleFrom (
88- side: BorderSide (color: Theme .of (context).dividerColor),
89- ),
90- icon: playPrefs.customVariant != Variant .standard
91- ? Icon (playPrefs.customVariant.icon)
92- : null ,
93- label: Text (playPrefs.customVariant.label (context.l10n)),
94- onPressed: () {
95- showChoicePicker (
96- context,
97- title: Text (context.l10n.variant),
98- choices: playSupportedVariants
99- .where ((v) => v != Variant .fromPosition)
100- .toList (),
101- selectedItem: playPrefs.customVariant,
102- labelBuilder: (variant) => VariantLabel (variant),
103- onSelectedItemChanged: (Variant variant) {
104- ref.read (gameSetupPreferencesProvider.notifier).setCustomVariant (variant);
105- },
106- );
107- },
108- ),
109- ],
110- ),
111- ),
112- ],
113- ),
114- if (account != null ) ...[
115- const SizedBox (height: 6.0 ),
116- Row (
117- children: [
118- Expanded (
89+ child: Semantics (
90+ container: true ,
91+ button: true ,
92+ label: '${context .l10n .variant }: ${playPrefs .customVariant .label (context .l10n )}' ,
93+ excludeSemantics: true ,
11994 child: Column (
12095 crossAxisAlignment: CrossAxisAlignment .stretch,
12196 mainAxisSize: MainAxisSize .min,
12297 children: [
123- Text (context.l10n.gameMode , style: labelStyle),
124- OutlinedButton (
98+ Text (context.l10n.variant , style: labelStyle),
99+ OutlinedButton . icon (
125100 style: OutlinedButton .styleFrom (
126101 side: BorderSide (color: Theme .of (context).dividerColor),
127102 ),
103+ icon: playPrefs.customVariant != Variant .standard
104+ ? Icon (playPrefs.customVariant.icon)
105+ : null ,
106+ label: Text (playPrefs.customVariant.label (context.l10n)),
128107 onPressed: () {
129108 showChoicePicker (
130109 context,
131- title: Text (context.l10n.gameMode ),
132- choices: [context.l10n.casual, context.l10n.rated],
133- selectedItem : playPrefs.customRated
134- ? context.l10n.rated
135- : context.l10n.casual ,
136- labelBuilder: (String label ) => Text (label ),
137- onSelectedItemChanged: (String label ) {
110+ title: Text (context.l10n.variant ),
111+ choices: playSupportedVariants
112+ . where ((v) => v != Variant .fromPosition)
113+ . toList (),
114+ selectedItem : playPrefs.customVariant ,
115+ labelBuilder: (variant ) => VariantLabel (variant ),
116+ onSelectedItemChanged: (Variant variant ) {
138117 ref
139118 .read (gameSetupPreferencesProvider.notifier)
140- .setCustomRated (label == context.l10n.rated );
119+ .setCustomVariant (variant );
141120 },
142121 );
143122 },
144- child: Text (playPrefs.customRated ? context.l10n.rated : context.l10n.casual),
145123 ),
146124 ],
147125 ),
148126 ),
127+ ),
128+ ],
129+ ),
130+ if (account != null ) ...[
131+ const SizedBox (height: 6.0 ),
132+ Row (
133+ children: [
134+ Expanded (
135+ child: Semantics (
136+ container: true ,
137+ button: true ,
138+ label:
139+ '${context .l10n .gameMode }: ${playPrefs .customRated ? context .l10n .rated : context .l10n .casual }' ,
140+ excludeSemantics: true ,
141+ child: Column (
142+ crossAxisAlignment: CrossAxisAlignment .stretch,
143+ mainAxisSize: MainAxisSize .min,
144+ children: [
145+ Text (context.l10n.gameMode, style: labelStyle),
146+ OutlinedButton (
147+ style: OutlinedButton .styleFrom (
148+ side: BorderSide (color: Theme .of (context).dividerColor),
149+ ),
150+ onPressed: () {
151+ showChoicePicker (
152+ context,
153+ title: Text (context.l10n.gameMode),
154+ choices: [context.l10n.casual, context.l10n.rated],
155+ selectedItem: playPrefs.customRated
156+ ? context.l10n.rated
157+ : context.l10n.casual,
158+ labelBuilder: (String label) => Text (label),
159+ onSelectedItemChanged: (String label) {
160+ ref
161+ .read (gameSetupPreferencesProvider.notifier)
162+ .setCustomRated (label == context.l10n.rated);
163+ },
164+ );
165+ },
166+ child: Text (
167+ playPrefs.customRated ? context.l10n.rated : context.l10n.casual,
168+ ),
169+ ),
170+ ],
171+ ),
172+ ),
173+ ),
149174 const SizedBox (width: 8.0 ),
150175 Expanded (
151- child: Column (
152- crossAxisAlignment: CrossAxisAlignment .stretch,
153- mainAxisSize: MainAxisSize .min,
154- children: [
155- GestureDetector (
156- onTap: canUseRatingRange
157- ? null
158- : () => _showDisabledRatingRangeExplanation (context),
159- child: Row (
160- mainAxisSize: .min,
161- children: [
162- Text (context.l10n.ratingFilter, style: labelStyle),
163- if (! canUseRatingRange)
164- Padding (
165- padding: const EdgeInsets .only (left: 4.0 ),
166- child: Icon (
167- Icons .info_outline,
168- size: 16.0 ,
169- color: Theme .of (context).disabledColor,
176+ child: Semantics (
177+ container: true ,
178+ button: true ,
179+ label:
180+ '${context .l10n .ratingFilter }: ${canUseRatingRange ? '${playPrefs .customRatingDelta .$1 == 0 ? '-' : '' }${playPrefs .customRatingDelta .$1 } / +${playPrefs .customRatingDelta .$2 }' : '-500 / +500' }' ,
181+ excludeSemantics: true ,
182+ child: Column (
183+ crossAxisAlignment: CrossAxisAlignment .stretch,
184+ mainAxisSize: MainAxisSize .min,
185+ children: [
186+ GestureDetector (
187+ onTap: canUseRatingRange
188+ ? null
189+ : () => _showDisabledRatingRangeExplanation (context),
190+ child: Row (
191+ mainAxisSize: .min,
192+ children: [
193+ Text (context.l10n.ratingFilter, style: labelStyle),
194+ if (! canUseRatingRange)
195+ Padding (
196+ padding: const EdgeInsets .only (left: 4.0 ),
197+ child: Icon (
198+ Icons .info_outline,
199+ size: 16.0 ,
200+ color: Theme .of (context).disabledColor,
201+ ),
170202 ),
171- ) ,
172- ] ,
203+ ] ,
204+ ) ,
173205 ),
174- ),
175- OutlinedButton (
176- style: OutlinedButton .styleFrom (
177- side: BorderSide (color: Theme .of (context).dividerColor),
178- foregroundColor: canUseRatingRange ? null : Theme .of (context).disabledColor,
206+ OutlinedButton (
207+ style: OutlinedButton .styleFrom (
208+ side: BorderSide (color: Theme .of (context).dividerColor),
209+ foregroundColor: canUseRatingRange
210+ ? null
211+ : Theme .of (context).disabledColor,
212+ ),
213+ onPressed: canUseRatingRange
214+ ? () {
215+ showModalBottomSheet <void >(
216+ context: context,
217+ constraints: BoxConstraints (
218+ minHeight: MediaQuery .heightOf (context) * 0.4 ,
219+ ),
220+ isScrollControlled: true ,
221+ builder: (BuildContext context) {
222+ return BottomSheetScrollableContainer (
223+ children: [
224+ PlayRatingRange (
225+ perf: userPerf,
226+ ratingDelta: playPrefs.customRatingDelta,
227+ onRatingDeltaChange: (int subtract, int add) {
228+ ref
229+ .read (gameSetupPreferencesProvider.notifier)
230+ .setCustomRatingRange (subtract, add);
231+ },
232+ ),
233+ ],
234+ );
235+ },
236+ );
237+ }
238+ : () => _showDisabledRatingRangeExplanation (context),
239+ child: canUseRatingRange
240+ ? Text (
241+ '${playPrefs .customRatingDelta .$1 == 0 ? '-' : '' }${playPrefs .customRatingDelta .$1 } / +${playPrefs .customRatingDelta .$2 }' ,
242+ )
243+ : const Text ('-500 / +500' ),
179244 ),
180- onPressed: canUseRatingRange
181- ? () {
182- showModalBottomSheet <void >(
183- context: context,
184- constraints: BoxConstraints (
185- minHeight: MediaQuery .heightOf (context) * 0.4 ,
186- ),
187- isScrollControlled: true ,
188- builder: (BuildContext context) {
189- return BottomSheetScrollableContainer (
190- children: [
191- PlayRatingRange (
192- perf: userPerf,
193- ratingDelta: playPrefs.customRatingDelta,
194- onRatingDeltaChange: (int subtract, int add) {
195- ref
196- .read (gameSetupPreferencesProvider.notifier)
197- .setCustomRatingRange (subtract, add);
198- },
199- ),
200- ],
201- );
202- },
203- );
204- }
205- : () => _showDisabledRatingRangeExplanation (context),
206- child: canUseRatingRange
207- ? Text (
208- '${playPrefs .customRatingDelta .$1 == 0 ? '-' : '' }${playPrefs .customRatingDelta .$1 } / +${playPrefs .customRatingDelta .$2 }' ,
209- )
210- : const Text ('-500 / +500' ),
211- ),
212- ],
245+ ],
246+ ),
213247 ),
214248 ),
215249 ],
0 commit comments