use hidden textfield to capture input

This commit is contained in:
open-trade 2020-11-22 18:29:04 +08:00
parent 25b2f52462
commit f6f7e1ead1
2 changed files with 132 additions and 118 deletions

View File

@ -138,8 +138,8 @@ class ImageModel with ChangeNotifier {
class CursorModel with ChangeNotifier {
ui.Image _image;
final _images = Map<int, ui.Image>();
double _x = 0;
double _y = 0;
double _x = -10000;
double _y = -10000;
double _hotx = 0;
double _hoty = 0;
double _displayOriginX = 0;
@ -189,6 +189,8 @@ class CursorModel with ChangeNotifier {
}
void clear() {
_x = -10000;
_x = -10000;
_image = null;
_images.clear();
}

View File

@ -85,10 +85,7 @@ class _RemotePageState extends State<RemotePage> {
// Size size = MediaQueryData.fromWindow(ui.window).size;
// MediaQuery.of(context).size.height;
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
return RawKeyboardListener(
focusNode: _focusNode,
onKey: _handleKeyEvent,
child: WillPopScope(
return WillPopScope(
onWillPop: () async {
close();
return false;
@ -125,9 +122,9 @@ class _RemotePageState extends State<RemotePage> {
onPressed: () {
SystemChrome.setEnabledSystemUIOverlays(
SystemUiOverlay.values);
_focusNode.requestFocus();
SystemChannels.textInput
.invokeMethod('TextInput.show');
_focusNode.requestFocus();
}),
Transform.rotate(
angle: 15 * math.pi / 180,
@ -208,9 +205,24 @@ class _RemotePageState extends State<RemotePage> {
child: Stack(children: [
ImagePaint(),
CursorPaint(),
SizedBox(
width: 0,
height: 0,
child: _bottom < 100
? Container()
: TextFormField(
textInputAction: TextInputAction.newline,
autocorrect: false,
enableSuggestions: false,
focusNode: _focusNode,
maxLines: null,
keyboardType: TextInputType.multiline,
onChanged: (x) => print('$x'),
),
),
])),
)),
)))));
))));
}
void close() {