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 { ...@@ -368,7 +368,18 @@ class ThemeData with Diagnosticable {
textTheme = defaultTextTheme.merge(textTheme); textTheme = defaultTextTheme.merge(textTheme);
primaryTextTheme = defaultPrimaryTextTheme.merge(primaryTextTheme); primaryTextTheme = defaultPrimaryTextTheme.merge(primaryTextTheme);
accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme); 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; applyElevationOverlayColor ??= false;
// Used as the default color (fill color) for RaisedButtons. Computing the // Used as the default color (fill color) for RaisedButtons. Computing the
......
...@@ -96,11 +96,21 @@ void main() { ...@@ -96,11 +96,21 @@ void main() {
expect(darkTheme.accentTextTheme.headline6.color, typography.white.headline6.color); expect(darkTheme.accentTextTheme.headline6.color, typography.white.headline6.color);
}); });
test('Defaults to MaterialTapTargetBehavior.expanded', () { testWidgets('Defaults to MaterialTapTargetBehavior.padded on mobile platforms and MaterialTapTargetBehavior.shrinkWrap on desktop', (WidgetTester tester) async {
final ThemeData themeData = ThemeData(); final ThemeData themeData = ThemeData(platform: defaultTargetPlatform);
switch (defaultTargetPlatform) {
expect(themeData.materialTapTargetSize, MaterialTapTargetSize.padded); 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', () { test('Can control fontFamily default', () {
final ThemeData themeData = ThemeData( final ThemeData themeData = ThemeData(
......
...@@ -25,6 +25,9 @@ void main() { ...@@ -25,6 +25,9 @@ void main() {
Axis scrollDirection = Axis.vertical, Axis scrollDirection = Axis.vertical,
}) { }) {
return MaterialApp( return MaterialApp(
theme: ThemeData(
materialTapTargetSize: MaterialTapTargetSize.padded,
),
home: Scaffold( home: Scaffold(
body: CustomScrollView( body: CustomScrollView(
scrollDirection: scrollDirection, 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