Skip to content

Commit e68a0fb

Browse files
committed
fix(touchable): fixed bug where Opacity cannot disappear after TouchableOpacity component is pressed
1 parent db827ef commit e68a0fb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/touchable.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,18 @@ class _TouchableOpacityState extends State<TouchableOpacity> {
7373
if (widget.onPressed != null) widget.onPressed();
7474
}
7575

76+
_onTapCancel(){
77+
setState(() {
78+
opacity = 1;
79+
});
80+
}
81+
7682
@override
7783
Widget build(BuildContext context) {
7884
return GestureDetector(
7985
onTapDown: this._onTapDown,
8086
onTapUp: this._onTapUp,
87+
onTapCancel: this._onTapCancel,
8188
child: Opacity(
8289
opacity: opacity,
8390
child: widget.child,

0 commit comments

Comments
 (0)