fix(sender): 触摸/鼠标/按键事件不再弹「已发送」提示
- SnackBar 只保留 requestMirror / stopMirror / clipboard 这类一次性动作 - 拖拽时触摸事件每秒几十条,每条弹一次提示会把 Flutter UI 线程压满, 既刷屏又拖慢串流
This commit is contained in:
1 parent
dd4cdf431c
commit
04f2b800b2
1 file changed
+5
-2
@@ -534,15 +534,18 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
void _sendControl(String type, Map<String, dynamic> payload) {
|
||||
_bridge.sendControl(type, payload);
|
||||
// 只有一次性动作才弹提示:触摸/鼠标/按键/滚轮是连续事件(拖拽时每秒几十条),
|
||||
// 每条都弹 SnackBar 会把 Flutter UI 线程压满,串流反而更卡。
|
||||
const labels = {
|
||||
'requestMirror': '投屏请求',
|
||||
'stopMirror': '停止投屏',
|
||||
'clipboard': '剪贴板内容',
|
||||
'ping': '心跳',
|
||||
};
|
||||
final label = labels[type];
|
||||
if (label == null) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('已发送${labels[type] ?? ' $type '}'),
|
||||
content: Text('已发送$label'),
|
||||
duration: const Duration(milliseconds: 900),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user