Unverified Commit 2d37e086 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[desktop] default to shrink wrap on desktop platforms (#66754)

parent 3063182e
......@@ -368,7 +368,18 @@ class ThemeData with Diagnosticable {
textTheme = defaultTextTheme.merge(textTheme);
primaryTextTheme = defaultPrimaryTextTheme.merge(primaryTextTheme);
accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme);
materialTapTargetSize ??= MaterialTapTargetSize.padded;
switch (platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.iOS:
materialTapTargetSize ??= MaterialTapTargetSize.padded;
break;
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
materialTapTargetSize ??= MaterialTapTargetSize.shrinkWrap;
break;
}
applyElevationOverlayColor ??= false;
// Used as the default color (fill color) for RaisedButtons. Computing the
......
......@@ -96,11 +96,21 @@ void main() {
expect(darkTheme.accentTextTheme.headline6.color, typography.white.headline6.color);
});
test('Defaults to MaterialTapTargetBehavior.expanded', () {
final ThemeData themeData = ThemeData();
expect(themeData.materialTapTargetSize, MaterialTapTargetSize.padded);
});
testWidgets('Defaults to MaterialTapTargetBehavior.padded on mobile platforms and MaterialTapTargetBehavior.shrinkWrap on desktop', (WidgetTester tester) async {
final ThemeData themeData = ThemeData(platform: defaultTargetPlatform);
switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.iOS:
expect(themeData.materialTapTargetSize, MaterialTapTargetSize.padded);
break;
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
expect(themeData.materialTapTargetSize, MaterialTapTargetSize.shrinkWrap);
break;
}
}, variant: TargetPlatformVariant.all());
test('Can control fontFamily default', () {
final ThemeData themeData = ThemeData(
......
......@@ -25,6 +25,9 @@ void main() {
Axis scrollDirection = Axis.vertical,
}) {
return MaterialApp(
theme: ThemeData(
materialTapTargetSize: MaterialTapTargetSize.padded,
),
home: Scaffold(
body: CustomScrollView(
scrollDirection: scrollDirection,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment