Unverified Commit 5a27340c authored by Jonathan Lau's avatar Jonathan Lau Committed by GitHub

Add minWidth constraint to RawChip when materialTapTargetSize is padded (#77881)

parent 180bb8c1
......@@ -2022,7 +2022,10 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
final Offset densityAdjustment = (widget.visualDensity ?? theme.visualDensity).baseSizeAdjustment;
switch (widget.materialTapTargetSize ?? theme.materialTapTargetSize) {
case MaterialTapTargetSize.padded:
constraints = BoxConstraints(minHeight: kMinInteractiveDimension + densityAdjustment.dy);
constraints = BoxConstraints(
minWidth: kMinInteractiveDimension + densityAdjustment.dx,
minHeight: kMinInteractiveDimension + densityAdjustment.dy,
);
break;
case MaterialTapTargetSize.shrinkWrap:
constraints = const BoxConstraints();
......
......@@ -500,6 +500,28 @@ void main() {
expect(tester.getSize(find.byType(Chip)), const Size(800.0, 48.0));
});
testWidgets('Chip responds to materialTapTargetSize', (WidgetTester tester) async {
await tester.pumpWidget(
_wrapForChip(
child: Column(
children: const <Widget>[
Chip(
label: Text('X'),
materialTapTargetSize: MaterialTapTargetSize.padded,
),
Chip(
label: Text('X'),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
],
),
),
);
expect(tester.getSize(find.byType(Chip).first), const Size(48.0, 48.0));
expect(tester.getSize(find.byType(Chip).last), const Size(38.0, 32.0));
},
);
testWidgets('Chip elements are ordered horizontally for locale', (WidgetTester tester) async {
final UniqueKey iconKey = UniqueKey();
final Widget test = Overlay(
......
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