[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);
|
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() {
|
|||||||
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() {
|
|||||||
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user