Choice Chip Fix (#22589)

* choice chip fix

* added test
This commit is contained in:
jslavitz 2018-10-03 11:08:01 -07:00 committed by GitHub
parent 2f6155bf18
commit 8d76d37f33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 77 additions and 4 deletions

View File

@ -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,

View File

@ -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,