This commit is contained in:
rustdesk 2021-08-17 15:20:37 +08:00
parent b521175bca
commit 1414ff5fcb

View File

@ -38,7 +38,7 @@ class _RemotePageState extends State<RemotePage> {
var _more = true; var _more = true;
var _fn = false; var _fn = false;
final FocusNode _focusNode = FocusNode(); final FocusNode _focusNode = FocusNode();
var _showEdit = false; var _showKeyboard = false;
var _reconnects = 1; var _reconnects = 1;
@override @override
@ -78,6 +78,7 @@ class _RemotePageState extends State<RemotePage> {
setState(() { setState(() {
_bottom = v; _bottom = v;
if (v < 100) { if (v < 100) {
_showKeyboard = false;
SystemChrome.setEnabledSystemUIOverlays([]); SystemChrome.setEnabledSystemUIOverlays([]);
} }
}); });
@ -155,12 +156,12 @@ class _RemotePageState extends State<RemotePage> {
void openKeyboard() { void openKeyboard() {
// destroy first, so that our _value trick can work // destroy first, so that our _value trick can work
_value = initText; _value = initText;
setState(() => _showEdit = false); setState(() => _showKeyboard = false);
_timer?.cancel(); _timer?.cancel();
_timer = Timer(Duration(milliseconds: 30), () { _timer = Timer(Duration(milliseconds: 30), () {
// show now, and sleep a while to requestFocus to // show now, and sleep a while to requestFocus to
// make sure edit ready, so that keyboard wont show/hide/show/hide happen // make sure edit ready, so that keyboard wont show/hide/show/hide happen
setState(() => _showEdit = true); setState(() => _showKeyboard = true);
_timer?.cancel(); _timer?.cancel();
_timer = Timer(Duration(milliseconds: 30), () { _timer = Timer(Duration(milliseconds: 30), () {
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
@ -173,7 +174,7 @@ class _RemotePageState extends State<RemotePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final pi = Provider.of<FfiModel>(context).pi; final pi = Provider.of<FfiModel>(context).pi;
final hideKeyboard = Platform.isIOS && _showEdit; final hideKeyboard = Platform.isIOS && _showKeyboard;
final showActionButton = !_showBar || hideKeyboard; final showActionButton = !_showBar || hideKeyboard;
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
return WillPopScope( return WillPopScope(
@ -192,7 +193,7 @@ class _RemotePageState extends State<RemotePage> {
onPressed: () { onPressed: () {
setState(() { setState(() {
if (hideKeyboard) { if (hideKeyboard) {
_showEdit = !_showEdit; _showKeyboard = !_showKeyboard;
} else { } else {
_showBar = !_showBar; _showBar = !_showBar;
} }
@ -222,7 +223,7 @@ class _RemotePageState extends State<RemotePage> {
color: Colors.white, color: Colors.white,
icon: Icon(Icons.tv), icon: Icon(Icons.tv),
onPressed: () { onPressed: () {
setState(() => _showEdit = false); setState(() => _showKeyboard = false);
showOptions(context); showOptions(context);
}, },
), ),
@ -243,7 +244,7 @@ class _RemotePageState extends State<RemotePage> {
color: Colors.white, color: Colors.white,
icon: Icon(Icons.more_vert), icon: Icon(Icons.more_vert),
onPressed: () { onPressed: () {
setState(() => _showEdit = false); setState(() => _showKeyboard = false);
showActions(context); showActions(context);
}, },
), ),
@ -323,7 +324,7 @@ class _RemotePageState extends State<RemotePage> {
SizedBox( SizedBox(
width: 0, width: 0,
height: 0, height: 0,
child: !_showEdit child: !_showKeyboard
? Container() ? Container()
: TextFormField( : TextFormField(
textInputAction: TextInputAction.newline, textInputAction: TextInputAction.newline,
@ -347,7 +348,7 @@ class _RemotePageState extends State<RemotePage> {
} }
Widget getHelpTools() { Widget getHelpTools() {
final keyboard = _showEdit; final keyboard = _showKeyboard;
if (!_mouseTools && !keyboard) { if (!_mouseTools && !keyboard) {
return SizedBox(); return SizedBox();
} }