mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
opt: thumbup gesture
This commit is contained in:
@@ -52,13 +52,13 @@ class ActionItemState extends State<ActionItem>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _cancelLongPress() {
|
void _cancelLongPress([bool isCancel = false]) {
|
||||||
int duration = DateTime.now().millisecondsSinceEpoch - _lastTime;
|
int duration = DateTime.now().millisecondsSinceEpoch - _lastTime;
|
||||||
if (duration < 1500) {
|
if (duration < 1500) {
|
||||||
controller?.reverse();
|
controller?.reverse();
|
||||||
widget.callBack!(false);
|
widget.callBack!(false);
|
||||||
}
|
}
|
||||||
if (duration <= 500) {
|
if (duration <= 500 && !isCancel) {
|
||||||
feedBack();
|
feedBack();
|
||||||
widget.onTap!();
|
widget.onTap!();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ class ActionItemState extends State<ActionItem>
|
|||||||
},
|
},
|
||||||
onTapDown: (details) => _isThumbUp ? _startLongPress() : null,
|
onTapDown: (details) => _isThumbUp ? _startLongPress() : null,
|
||||||
onTapUp: (details) => _isThumbUp ? _cancelLongPress() : null,
|
onTapUp: (details) => _isThumbUp ? _cancelLongPress() : null,
|
||||||
onTapCancel: () => _isThumbUp ? _cancelLongPress() : null,
|
onTapCancel: () => _isThumbUp ? _cancelLongPress(true) : null,
|
||||||
// borderRadius: StyleString.mdRadius,
|
// borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
Reference in New Issue
Block a user