[desktop] default to shrink wrap on desktop platforms (#66754)
This commit is contained in:
parent
3063182e77
commit
2d37e086ca
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user