add vibration to long tap
This commit is contained in:
@@ -66,14 +66,18 @@ class _MainMenuButtonState extends State<MainMenuButton>
|
|||||||
onTapDown: (_) {
|
onTapDown: (_) {
|
||||||
_animationController.forward();
|
_animationController.forward();
|
||||||
if (widget.onLongPressed != null) {
|
if (widget.onLongPressed != null) {
|
||||||
_longPressTimer = Timer(const Duration(milliseconds: 400), () {
|
_longPressTimer = Timer(
|
||||||
_isLongPressing = true;
|
const Duration(milliseconds: 400),
|
||||||
widget.onLongPressed?.call();
|
() async {
|
||||||
_repeatTimer = Timer.periodic(
|
_isLongPressing = true;
|
||||||
const Duration(milliseconds: 250),
|
await HapticFeedback.vibrate();
|
||||||
(_) => widget.onLongPressed?.call(),
|
widget.onLongPressed?.call();
|
||||||
);
|
_repeatTimer = Timer.periodic(
|
||||||
});
|
const Duration(milliseconds: 250),
|
||||||
|
(_) => widget.onLongPressed?.call(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTapUp: (_) async {
|
onTapUp: (_) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user