Skip to content

Commit 140b51f

Browse files
[material_ui] Migrate M3 Time Picker template to use new gen_defaults (#13164)
Work toward flutter/flutter#187899. Fixes flutter/flutter#188439 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent dae4525 commit 140b51f

5 files changed

Lines changed: 110 additions & 444 deletions

File tree

packages/material_ui/tool/gen_defaults/temporarily_excluded/generated/time_picker_defaults.g.dart renamed to packages/material_ui/lib/src/generated/time_picker_defaults_m3.g.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// Do not edit by hand. The code is generated from data in the Material
6+
// Design token database by the script:
7+
// packages/material_ui/tool/gen_defaults/bin/gen_defaults.dart.
8+
part of '../time_picker.dart';
9+
510
class _TimePickerDefaultsM3 extends _TimePickerDefaults {
611
_TimePickerDefaultsM3(this.context, {this.entryMode = TimePickerEntryMode.dial});
712

@@ -46,19 +51,18 @@ class _TimePickerDefaultsM3 extends _TimePickerDefaults {
4651

4752
@override
4853
OutlinedBorder get dayPeriodShape {
49-
return const RoundedRectangleBorder(
50-
borderRadius: BorderRadius.all(Radius.circular(8.0)),
51-
).copyWith(side: dayPeriodBorderSide);
54+
return const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0)))
55+
.copyWith(side: dayPeriodBorderSide);
5256
}
5357

5458
@override
5559
Size get dayPeriodPortraitSize {
56-
return const Size(52, 80);
60+
return const Size(52.0, 80.0);
5761
}
5862

5963
@override
6064
Size get dayPeriodLandscapeSize {
61-
return const Size(216, 38);
65+
return const Size(216.0, 38.0);
6266
}
6367

6468
@override
@@ -118,17 +122,17 @@ class _TimePickerDefaultsM3 extends _TimePickerDefaults {
118122

119123
@override
120124
double get handWidth {
121-
return const Size(2, double.infinity).width;
125+
return 2.0;
122126
}
123127

124128
@override
125129
double get dotRadius {
126-
return const Size.square(48.0).width / 2;
130+
return 48.0 / 2;
127131
}
128132

129133
@override
130134
double get centerRadius {
131-
return const Size.square(8.0).width / 2;
135+
return 8.0 / 2;
132136
}
133137

134138
@override
@@ -177,23 +181,19 @@ class _TimePickerDefaultsM3 extends _TimePickerDefaults {
177181
if (states.contains(WidgetState.pressed)) {
178182
overlayColor = _colors.onPrimaryContainer;
179183
} else if (states.contains(WidgetState.hovered)) {
180-
const hoverOpacity = 0.08;
181-
overlayColor = _colors.onPrimaryContainer.withOpacity(hoverOpacity);
184+
overlayColor = _colors.onPrimaryContainer.withOpacity(0.08);
182185
} else if (states.contains(WidgetState.focused)) {
183-
const focusOpacity = 0.1;
184-
overlayColor = _colors.onPrimaryContainer.withOpacity(focusOpacity);
186+
overlayColor = _colors.onPrimaryContainer.withOpacity(0.1);
185187
}
186188
return Color.alphaBlend(overlayColor, _colors.primaryContainer);
187189
} else {
188190
Color overlayColor = _colors.surfaceContainerHighest;
189191
if (states.contains(WidgetState.pressed)) {
190192
overlayColor = _colors.onSurface;
191193
} else if (states.contains(WidgetState.hovered)) {
192-
const hoverOpacity = 0.08;
193-
overlayColor = _colors.onSurface.withOpacity(hoverOpacity);
194+
overlayColor = _colors.onSurface.withOpacity(0.08);
194195
} else if (states.contains(WidgetState.focused)) {
195-
const focusOpacity = 0.1;
196-
overlayColor = _colors.onSurface.withOpacity(focusOpacity);
196+
overlayColor = _colors.onSurface.withOpacity(0.1);
197197
}
198198
return Color.alphaBlend(overlayColor, _colors.surfaceContainerHighest);
199199
}
@@ -207,12 +207,12 @@ class _TimePickerDefaultsM3 extends _TimePickerDefaults {
207207

208208
@override
209209
Size get hourMinuteSize {
210-
return const Size(96, 80);
210+
return const Size(96.0, 80.0);
211211
}
212212

213213
@override
214214
Size get hourMinuteSize24Hour {
215-
return Size(const Size(114, double.infinity).width, hourMinuteSize.height);
215+
return Size(114.0, hourMinuteSize.height);
216216
}
217217

218218
@override

0 commit comments

Comments
 (0)