listen flutter key event when there's no input monitor permission

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-02-21 18:43:43 +08:00
parent 6157889bb0
commit 9dbd1f88f5
7 changed files with 25 additions and 13 deletions

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/models/state_model.dart';
import '../../common.dart';
import '../../models/input_model.dart';
class RawKeyFocusScope extends StatelessWidget {
@@ -20,13 +18,6 @@ class RawKeyFocusScope extends StatelessWidget {
@override
Widget build(BuildContext context) {
final FocusOnKeyCallback? onKey;
if (isAndroid) {
onKey = inputModel.handleRawKeyEvent;
} else {
onKey = stateGlobal.grabKeyboard ? inputModel.handleRawKeyEvent : null;
}
return FocusScope(
autofocus: true,
child: Focus(
@@ -34,7 +25,7 @@ class RawKeyFocusScope extends StatelessWidget {
canRequestFocus: true,
focusNode: focusNode,
onFocusChange: onFocusChange,
onKey: onKey,
onKey: inputModel.handleRawKeyEvent,
child: child));
}
}