Fix ink highlight effect of RawChip (#28653)

This commit is contained in:
ocavue 2019-03-02 02:33:58 +08:00 committed by Hans Muller
parent 604e9dc683
commit 1df28e8b7a
2 changed files with 17 additions and 1 deletions

View File

@ -1625,10 +1625,11 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
animationDuration: pressedAnimationDuration, animationDuration: pressedAnimationDuration,
shape: shape, shape: shape,
clipBehavior: widget.clipBehavior, clipBehavior: widget.clipBehavior,
child: InkResponse( child: InkWell(
onTap: canTap ? _handleTap : null, onTap: canTap ? _handleTap : null,
onTapDown: canTap ? _handleTapDown : null, onTapDown: canTap ? _handleTapDown : null,
onTapCancel: canTap ? _handleTapCancel : null, onTapCancel: canTap ? _handleTapCancel : null,
customBorder: shape,
child: AnimatedBuilder( child: AnimatedBuilder(
animation: Listenable.merge(<Listenable>[selectController, enableController]), animation: Listenable.merge(<Listenable>[selectController, enableController]),
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {

View File

@ -1649,4 +1649,19 @@ void main() {
const Offset(4, 4), const Offset(4, 4),
])); ]));
}); });
testWidgets('Chips should use InkWell instead of InkResponse.', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/28646
await tester.pumpWidget(
MaterialApp(
home: Material(
child: ActionChip(
onPressed: (){},
label: const Text('action chip'),
),
),
),
);
expect(find.byType(InkWell), findsOneWidget);
});
} }