mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-29 08:19:05 +08:00
fix keyboard not shown on some android problem because my stupid change,
also make long press not only for right click, so that to make show password eye work
This commit is contained in:
parent
903a4ea27f
commit
ce3e9ce8d6
@ -38,7 +38,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
var _more = true;
|
||||
var _fn = false;
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
var _showKeyboard = false;
|
||||
var _showEdit = false;
|
||||
var _reconnects = 1;
|
||||
var _touchMode = false;
|
||||
|
||||
@ -75,6 +75,10 @@ class _RemotePageState extends State<RemotePage> {
|
||||
FFI.resetModifiers();
|
||||
}
|
||||
|
||||
bool isKeyboardShown() {
|
||||
return _bottom >= 100;
|
||||
}
|
||||
|
||||
void interval() {
|
||||
var v = MediaQuery.of(context).viewInsets.bottom;
|
||||
if (v != _bottom) {
|
||||
@ -82,7 +86,6 @@ class _RemotePageState extends State<RemotePage> {
|
||||
setState(() {
|
||||
_bottom = v;
|
||||
if (v < 100) {
|
||||
_showKeyboard = false;
|
||||
SystemChrome.setEnabledSystemUIOverlays([]);
|
||||
}
|
||||
});
|
||||
@ -197,12 +200,12 @@ class _RemotePageState extends State<RemotePage> {
|
||||
// destroy first, so that our _value trick can work
|
||||
_value = initText;
|
||||
resetMouse();
|
||||
setState(() => _showKeyboard = false);
|
||||
setState(() => _showEdit = false);
|
||||
_timer?.cancel();
|
||||
_timer = Timer(Duration(milliseconds: 30), () {
|
||||
// show now, and sleep a while to requestFocus to
|
||||
// make sure edit ready, so that keyboard wont show/hide/show/hide happen
|
||||
setState(() => _showKeyboard = true);
|
||||
setState(() => _showEdit = true);
|
||||
_timer?.cancel();
|
||||
_timer = Timer(Duration(milliseconds: 30), () {
|
||||
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
||||
@ -222,7 +225,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pi = Provider.of<FfiModel>(context).pi;
|
||||
final hideKeyboard = Platform.isIOS && _showKeyboard;
|
||||
final hideKeyboard = isKeyboardShown() && _showEdit;
|
||||
final showActionButton = !_showBar || hideKeyboard;
|
||||
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
||||
return WillPopScope(
|
||||
@ -241,7 +244,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (hideKeyboard) {
|
||||
_showKeyboard = !_showKeyboard;
|
||||
_showEdit = false;
|
||||
} else {
|
||||
_showBar = !_showBar;
|
||||
}
|
||||
@ -271,7 +274,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
color: Colors.white,
|
||||
icon: Icon(Icons.tv),
|
||||
onPressed: () {
|
||||
setState(() => _showKeyboard = false);
|
||||
setState(() => _showEdit = false);
|
||||
showOptions(context);
|
||||
},
|
||||
),
|
||||
@ -292,7 +295,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
color: Colors.white,
|
||||
icon: Icon(Icons.more_vert),
|
||||
onPressed: () {
|
||||
setState(() => _showKeyboard = false);
|
||||
setState(() => _showEdit = false);
|
||||
showActions(context);
|
||||
},
|
||||
),
|
||||
@ -314,8 +317,14 @@ class _RemotePageState extends State<RemotePage> {
|
||||
child: GestureDetector(
|
||||
onLongPress: () {
|
||||
if (_drag || _scroll) return;
|
||||
// make right click and real left long click both work
|
||||
// should add "long press = right click" option?
|
||||
FFI.sendMouse('down', 'left');
|
||||
FFI.tap(true);
|
||||
},
|
||||
onLongPressUp: () {
|
||||
FFI.sendMouse('up', 'left');
|
||||
},
|
||||
onTapUp: (details) {
|
||||
if (_drag || _scroll) return;
|
||||
if (_touchMode) {
|
||||
@ -376,7 +385,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
SizedBox(
|
||||
width: 0,
|
||||
height: 0,
|
||||
child: !_showKeyboard
|
||||
child: !_showEdit
|
||||
? Container()
|
||||
: TextFormField(
|
||||
textInputAction:
|
||||
@ -487,7 +496,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
}
|
||||
|
||||
Widget getHelpTools() {
|
||||
final keyboard = _showKeyboard;
|
||||
final keyboard = isKeyboardShown();
|
||||
if (!_mouseTools && !keyboard) {
|
||||
return SizedBox();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.1.8+19
|
||||
version: 1.1.9+20
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user