From c6f6de6d1b18e62027424c5225263f0a21ee7ff2 Mon Sep 17 00:00:00 2001 From: Jose Alba Date: Thu, 18 Jun 2020 14:48:03 -0400 Subject: [PATCH] Chips text scaling (#57745) --- packages/flutter/lib/src/material/chip.dart | 13 ++++++++++++- packages/flutter/lib/src/material/chip_theme.dart | 5 +---- packages/flutter/test/material/chip_test.dart | 4 ++-- packages/flutter/test/material/chip_theme_test.dart | 7 ++++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 5ee36545e8..d31a6ab63d 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -1823,6 +1823,16 @@ class _RawChipState extends State with TickerProviderStateMixin with TickerProviderStateMixin(effectiveLabelStyle?.color, _states); final TextStyle resolvedLabelStyle = effectiveLabelStyle?.copyWith(color: resolvedLabelColor); + final EdgeInsetsGeometry labelPadding = widget.labelPadding ?? chipTheme.labelPadding ?? _defaultLabelPadding; Widget result = Material( elevation: isTapping ? pressElevation : elevation, @@ -1896,7 +1907,7 @@ class _RawChipState extends State with TickerProviderStateMixin()); expect(lightTheme.labelStyle.color, equals(Colors.black.withAlpha(0xde))); @@ -202,7 +202,7 @@ void main() { expect(darkTheme.disabledColor, equals(Colors.white.withAlpha(0x0c))); expect(darkTheme.selectedColor, equals(Colors.white.withAlpha(0x3d))); expect(darkTheme.secondarySelectedColor, equals(customColor1.withAlpha(0x3d))); - expect(darkTheme.labelPadding, equals(const EdgeInsets.symmetric(horizontal: 8.0))); + expect(darkTheme.labelPadding, isNull); expect(darkTheme.padding, equals(const EdgeInsets.all(4.0))); expect(darkTheme.shape, isA()); expect(darkTheme.labelStyle.color, equals(Colors.white.withAlpha(0xde))); @@ -220,7 +220,7 @@ void main() { expect(customTheme.disabledColor, equals(customColor1.withAlpha(0x0c))); expect(customTheme.selectedColor, equals(customColor1.withAlpha(0x3d))); expect(customTheme.secondarySelectedColor, equals(customColor2.withAlpha(0x3d))); - expect(customTheme.labelPadding, equals(const EdgeInsets.symmetric(horizontal: 8.0))); + expect(customTheme.labelPadding, isNull); expect(customTheme.padding, equals(const EdgeInsets.all(4.0))); expect(customTheme.shape, isA()); expect(customTheme.labelStyle.color, equals(customColor1.withAlpha(0xde))); @@ -235,6 +235,7 @@ void main() { labelStyle: ThemeData.fallback().textTheme.bodyText1.copyWith(color: Colors.black), ).copyWith( elevation: 1.0, + labelPadding: const EdgeInsets.symmetric(horizontal: 8.0), pressElevation: 4.0, shadowColor: Colors.black, selectedShadowColor: Colors.black,