Add minWidth constraint to RawChip when materialTapTargetSize is padded (#77881)
This commit is contained in:
parent
180bb8c1f8
commit
5a27340c45
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user