Skip to content

Commit

Permalink
Updated token templates to sync with master code. (#117097)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenaustin authored Dec 14, 2022
1 parent aa0b681 commit d8b7eb6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dev/tools/gen_defaults/lib/action_chip_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
EdgeInsetsGeometry? get labelPadding => EdgeInsets.lerp(
const EdgeInsets.symmetric(horizontal: 8.0),
const EdgeInsets.symmetric(horizontal: 4.0),
clampDouble(MediaQuery.of(context).textScaleFactor - 1.0, 0.0, 1.0),
clampDouble(MediaQuery.textScaleFactorOf(context) - 1.0, 0.0, 1.0),
)!;
}
''';
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/gen_defaults/lib/filter_chip_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
EdgeInsetsGeometry? get labelPadding => EdgeInsets.lerp(
const EdgeInsets.symmetric(horizontal: 8.0),
const EdgeInsets.symmetric(horizontal: 4.0),
clampDouble(MediaQuery.of(context).textScaleFactor - 1.0, 0.0, 1.0),
clampDouble(MediaQuery.textScaleFactorOf(context) - 1.0, 0.0, 1.0),
)!;
}
''';
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/gen_defaults/lib/input_chip_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
EdgeInsetsGeometry? get labelPadding => EdgeInsets.lerp(
const EdgeInsets.symmetric(horizontal: 8.0),
const EdgeInsets.symmetric(horizontal: 4.0),
clampDouble(MediaQuery.of(context).textScaleFactor - 1.0, 0.0, 1.0),
clampDouble(MediaQuery.textScaleFactorOf(context) - 1.0, 0.0, 1.0),
)!;
}
''';
Expand Down
5 changes: 4 additions & 1 deletion dev/tools/gen_defaults/lib/menu_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class _MenuBarDefaultsM3 extends MenuStyle {
shape: const MaterialStatePropertyAll<OutlinedBorder>(_defaultMenuBorder),
alignment: AlignmentDirectional.bottomStart,
);
static const RoundedRectangleBorder _defaultMenuBorder =
${shape('md.comp.menu.container', '')};
Expand Down Expand Up @@ -60,6 +61,7 @@ class _MenuButtonDefaultsM3 extends ButtonStyle {
enableFeedback: true,
alignment: AlignmentDirectional.centerStart,
);
final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme;
Expand Down Expand Up @@ -190,7 +192,7 @@ class _MenuButtonDefaultsM3 extends ButtonStyle {
const EdgeInsets.symmetric(horizontal: 12),
const EdgeInsets.symmetric(horizontal: 8),
const EdgeInsets.symmetric(horizontal: 4),
MediaQuery.maybeOf(context)?.textScaleFactor ?? 1,
MediaQuery.maybeTextScaleFactorOf(context) ?? 1,
);
}
}
Expand All @@ -202,6 +204,7 @@ class _MenuDefaultsM3 extends MenuStyle {
shape: const MaterialStatePropertyAll<OutlinedBorder>(_defaultMenuBorder),
alignment: AlignmentDirectional.topEnd,
);
static const RoundedRectangleBorder _defaultMenuBorder =
${shape('md.comp.menu.container', '')};
Expand Down
7 changes: 5 additions & 2 deletions dev/tools/gen_defaults/lib/time_picker_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,11 @@ class _${blockName}DefaultsM3 extends _TimePickerDefaults {
InputDecorationTheme get inputDecorationTheme {
// This is NOT correct, but there's no token for
// 'time-input.container.shape', so this is using the radius from the shape
// for the hour/minute selector.
final BorderRadiusGeometry selectorRadius = ${shape('$hourMinuteComponent.container')}.borderRadius;
// for the hour/minute selector. It's a BorderRadiusGeometry, so we have to
// resolve it before we can use it.
final BorderRadius selectorRadius = ${shape('$hourMinuteComponent.container')}
.borderRadius
.resolve(Directionality.of(context));
return InputDecorationTheme(
contentPadding: EdgeInsets.zero,
filled: true,
Expand Down
4 changes: 1 addition & 3 deletions packages/flutter/lib/src/material/time_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3684,9 +3684,7 @@ class _TimePickerDefaultsM3 extends _TimePickerDefaults {
// 'time-input.container.shape', so this is using the radius from the shape
// for the hour/minute selector. It's a BorderRadiusGeometry, so we have to
// resolve it before we can use it.
final BorderRadius selectorRadius = const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
)
final BorderRadius selectorRadius = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0)))
.borderRadius
.resolve(Directionality.of(context));
return InputDecorationTheme(
Expand Down

0 comments on commit d8b7eb6

Please sign in to comment.