feat: flutter优化滑动不跟手

This commit is contained in:
2026-07-14 20:55:30 +08:00
parent 5cc47f9fb3
commit 3e46e1e4f3
4 changed files with 62 additions and 10 deletions

View File

@@ -233,15 +233,15 @@ class _ControllerHomeState extends State<ControllerHome> {
RTCVideoViewObjectFit.RTCVideoViewObjectFitContain,
),
RemoteTouchView(
onTouch: (x, y) => _controller
?.sendControlCommand(ControlCommands.touch(x, y)),
onSwipe: (x1, y1, x2, y2, d) => _controller
?.sendControlCommand(
ControlCommands.swipe(x1, y1, x2, y2, d)),
// 禁用离散的 TOUCH/SWIPE/LONG_PRESS 指令,改用实时的 onMotionEvent 以解决重复操作问题。
// 原始的动作流已包含完整的触摸过程,被控端系统会自动识别单击、滑动和长按。
onTouch: (x, y) {},
onSwipe: (x1, y1, x2, y2, d) {},
onLongPress: (x, y) {},
onKey: (k, a) => _controller
?.sendControlCommand(ControlCommands.key(k, a)),
onLongPress: (x, y) => _controller
?.sendControlCommand(ControlCommands.longPress(x, y)),
onMotionEvent: (a, x, y) => _controller
?.sendControlCommand(ControlCommands.motionEvent(a, x, y)),
),
],
),