From 5d11700bddc4983b1931233c932f0d8904d67d45 Mon Sep 17 00:00:00 2001 From: open-trade Date: Fri, 20 Nov 2020 17:20:42 +0800 Subject: [PATCH] invoke keyboard, problem is the keyboard type has problem --- flutter_hbb/lib/remote_page.dart | 15 +++++++++++++-- flutter_hbb/pubspec.lock | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index 84166d2fa..e284b591d 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -5,9 +5,9 @@ import 'dart:ui' as ui; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'dart:async'; import 'dart:math' as math; +import 'package:tuple/tuple.dart'; import 'common.dart'; import 'model.dart'; -import 'package:tuple/tuple.dart'; class RemotePage extends StatefulWidget { RemotePage({Key key, this.id}) : super(key: key); @@ -22,6 +22,7 @@ class RemotePage extends StatefulWidget { class _RemotePageState extends State { Timer _interval; bool _showBar = true; + double _bottom = 0; @override void initState() { @@ -46,6 +47,15 @@ class _RemotePageState extends State { } void interval() { + var v = MediaQuery.of(context).viewInsets.bottom; + if (v != _bottom) { + setState(() { + _bottom = v; + if (v < 80) { + SystemChrome.setEnabledSystemUIOverlays([]); + } + }); + } FFI.ffiModel.update(widget.id, context, handleMsgbox); } @@ -100,7 +110,8 @@ class _RemotePageState extends State { IconButton( color: Colors.white, icon: Icon(Icons.keyboard), - onPressed: () {}, + onPressed: () => SystemChannels.textInput + .invokeMethod('TextInput.show'), ), Transform.rotate( angle: 15 * math.pi / 180, diff --git a/flutter_hbb/pubspec.lock b/flutter_hbb/pubspec.lock index e4f1ca350..3b1d42184 100644 --- a/flutter_hbb/pubspec.lock +++ b/flutter_hbb/pubspec.lock @@ -82,7 +82,7 @@ packages: name: flutter_easyloading url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.2.0" flutter_spinkit: dependency: transitive description: