diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 1c98e319dc..e90235fd47 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -575,7 +575,7 @@ class InputChip extends StatelessWidget this.deleteIconColor, this.deleteButtonTooltipMessage, this.onPressed, - this.pressElevation, + this.pressElevation = 8.0, this.disabledColor, this.selectedColor, this.tooltip, @@ -731,7 +731,7 @@ class ChoiceChip extends StatelessWidget this.labelStyle, this.labelPadding, this.onSelected, - this.pressElevation, + this.pressElevation = 8.0, @required this.selected, this.selectedColor, this.disabledColor, @@ -908,7 +908,7 @@ class FilterChip extends StatelessWidget this.labelPadding, this.selected = false, @required this.onSelected, - this.pressElevation, + this.pressElevation = 8.0, this.disabledColor, this.selectedColor, this.tooltip, @@ -1037,7 +1037,7 @@ class ActionChip extends StatelessWidget implements ChipAttributes, TappableChip this.labelStyle, this.labelPadding, @required this.onPressed, - this.pressElevation, + this.pressElevation = 8.0, this.tooltip, this.shape, this.clipBehavior = Clip.none, diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index e379c8d111..fa906fcb8e 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -1403,6 +1403,79 @@ void main() { expect(deleted, true); }); + testWidgets('Chips can be tapped', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: Material( + child: ChoiceChip( + selected: false, + label: Text('choice chip'), + ), + ), + ), + ); + + await tester.tap(find.byType(ChoiceChip)); + expect(tester.takeException(), null); + + await tester.pumpWidget( + const MaterialApp( + home: Material( + child: RawChip( + selected: false, + label: Text('raw chip'), + ), + ), + ), + ); + + await tester.tap(find.byType(RawChip)); + expect(tester.takeException(), null); + + await tester.pumpWidget( + MaterialApp( + home: Material( + child: ActionChip( + onPressed: (){}, + label: const Text('action chip'), + ), + ), + ), + ); + + await tester.tap(find.byType(ActionChip)); + expect(tester.takeException(), null); + + await tester.pumpWidget( + MaterialApp( + home: Material( + child: FilterChip( + onSelected: (bool valueChanged){}, + selected: false, + label: const Text('filter chip'), + ), + ), + ), + ); + + await tester.tap(find.byType(FilterChip)); + expect(tester.takeException(), null); + + await tester.pumpWidget( + const MaterialApp( + home: Material( + child: InputChip( + selected: false, + label: Text('input chip'), + ), + ), + ), + ); + + await tester.tap(find.byType(InputChip)); + expect(tester.takeException(), null); + }); + testWidgets('Chip elevation works correctly', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android,