change GestureHelp from ModalBottomSheet to bottomNavigationBar, add show KeyTools when GestureHelp showed
This commit is contained in:
parent
4b52431dbf
commit
14a187f471
@ -36,12 +36,13 @@ class RemotePage extends StatefulWidget {
|
|||||||
class _RemotePageState extends State<RemotePage> {
|
class _RemotePageState extends State<RemotePage> {
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
bool _showBar = !isWebDesktop;
|
bool _showBar = !isWebDesktop;
|
||||||
|
bool _showGestureHelp = false;
|
||||||
String _value = '';
|
String _value = '';
|
||||||
double _scale = 1;
|
double _scale = 1;
|
||||||
double _mouseScrollIntegral = 0; // mouse scroll speed controller
|
double _mouseScrollIntegral = 0; // mouse scroll speed controller
|
||||||
Orientation? _currentOrientation;
|
Orientation? _currentOrientation;
|
||||||
|
|
||||||
late final keyboardVisibilityController = KeyboardVisibilityController();
|
final keyboardVisibilityController = KeyboardVisibilityController();
|
||||||
late final StreamSubscription<bool> keyboardSubscription;
|
late final StreamSubscription<bool> keyboardSubscription;
|
||||||
final FocusNode _mobileFocusNode = FocusNode();
|
final FocusNode _mobileFocusNode = FocusNode();
|
||||||
final FocusNode _physicalFocusNode = FocusNode();
|
final FocusNode _physicalFocusNode = FocusNode();
|
||||||
@ -197,9 +198,9 @@ 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 isHideKeyboardFAB =
|
final keyboardIsVisible =
|
||||||
keyboardVisibilityController.isVisible && _showEdit;
|
keyboardVisibilityController.isVisible && _showEdit;
|
||||||
final showActionButton = !_showBar || isHideKeyboardFAB;
|
final showActionButton = !_showBar || keyboardIsVisible || _showGestureHelp;
|
||||||
final keyboard = gFFI.ffiModel.permissions['keyboard'] != false;
|
final keyboard = gFFI.ffiModel.permissions['keyboard'] != false;
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
@ -209,33 +210,39 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
},
|
},
|
||||||
child: getRawPointerAndKeyBody(Scaffold(
|
child: getRawPointerAndKeyBody(Scaffold(
|
||||||
// workaround for https://github.com/rustdesk/rustdesk/issues/3131
|
// workaround for https://github.com/rustdesk/rustdesk/issues/3131
|
||||||
floatingActionButtonLocation: isHideKeyboardFAB
|
floatingActionButtonLocation: keyboardIsVisible
|
||||||
? FABLocation(FloatingActionButtonLocation.endFloat, 0, -35)
|
? FABLocation(FloatingActionButtonLocation.endFloat, 0, -35)
|
||||||
: null,
|
: null,
|
||||||
floatingActionButton: !showActionButton
|
floatingActionButton: !showActionButton
|
||||||
? null
|
? null
|
||||||
: FloatingActionButton(
|
: FloatingActionButton(
|
||||||
mini: !isHideKeyboardFAB,
|
mini: !keyboardIsVisible,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
isHideKeyboardFAB ? Icons.expand_more : Icons.expand_less,
|
(keyboardIsVisible || _showGestureHelp)
|
||||||
|
? Icons.expand_more
|
||||||
|
: Icons.expand_less,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
backgroundColor: MyTheme.accent,
|
backgroundColor: MyTheme.accent,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (isHideKeyboardFAB) {
|
if (keyboardIsVisible) {
|
||||||
_showEdit = false;
|
_showEdit = false;
|
||||||
gFFI.invokeMethod("enable_soft_keyboard", false);
|
gFFI.invokeMethod("enable_soft_keyboard", false);
|
||||||
_mobileFocusNode.unfocus();
|
_mobileFocusNode.unfocus();
|
||||||
_physicalFocusNode.requestFocus();
|
_physicalFocusNode.requestFocus();
|
||||||
|
} else if (_showGestureHelp) {
|
||||||
|
_showGestureHelp = false;
|
||||||
} else {
|
} else {
|
||||||
_showBar = !_showBar;
|
_showBar = !_showBar;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
bottomNavigationBar: _showBar && pi.displays.isNotEmpty
|
bottomNavigationBar: _showGestureHelp
|
||||||
? getBottomAppBar(keyboard)
|
? getGestureHelp()
|
||||||
: null,
|
: (_showBar && pi.displays.isNotEmpty
|
||||||
|
? getBottomAppBar(keyboard)
|
||||||
|
: null),
|
||||||
body: Overlay(
|
body: Overlay(
|
||||||
initialEntries: [
|
initialEntries: [
|
||||||
OverlayEntry(builder: (context) {
|
OverlayEntry(builder: (context) {
|
||||||
@ -325,7 +332,8 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
icon: Icon(gFFI.ffiModel.touchMode
|
icon: Icon(gFFI.ffiModel.touchMode
|
||||||
? Icons.touch_app
|
? Icons.touch_app
|
||||||
: Icons.mouse),
|
: Icons.mouse),
|
||||||
onPressed: changeTouchMode,
|
onPressed: () => setState(
|
||||||
|
() => _showGestureHelp = !_showGestureHelp),
|
||||||
),
|
),
|
||||||
]) +
|
]) +
|
||||||
(isWeb
|
(isWeb
|
||||||
@ -488,7 +496,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
right: 10,
|
right: 10,
|
||||||
child: QualityMonitor(gFFI.qualityMonitorModel),
|
child: QualityMonitor(gFFI.qualityMonitorModel),
|
||||||
),
|
),
|
||||||
KeyHelpTools(requestShow: keyboardIsVisible),
|
KeyHelpTools(requestShow: (keyboardIsVisible || _showGestureHelp)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
@ -658,29 +666,20 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
}();
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeTouchMode() {
|
/// aka changeTouchMode
|
||||||
setState(() => _showEdit = false);
|
BottomAppBar getGestureHelp() {
|
||||||
showModalBottomSheet(
|
return BottomAppBar(
|
||||||
// backgroundColor: MyTheme.grayBg,
|
child: SingleChildScrollView(
|
||||||
isScrollControlled: true,
|
controller: ScrollController(),
|
||||||
context: context,
|
padding: EdgeInsets.symmetric(vertical: 10),
|
||||||
shape: const RoundedRectangleBorder(
|
child: GestureHelp(
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(5))),
|
touchMode: gFFI.ffiModel.touchMode,
|
||||||
builder: (context) => DraggableScrollableSheet(
|
onTouchModeChange: (t) {
|
||||||
expand: false,
|
gFFI.ffiModel.toggleTouchMode();
|
||||||
builder: (context, scrollController) {
|
final v = gFFI.ffiModel.touchMode ? 'Y' : '';
|
||||||
return SingleChildScrollView(
|
bind.sessionPeerOption(
|
||||||
controller: ScrollController(),
|
id: widget.id, name: "touch", value: v);
|
||||||
padding: EdgeInsets.symmetric(vertical: 10),
|
})));
|
||||||
child: GestureHelp(
|
|
||||||
touchMode: gFFI.ffiModel.touchMode,
|
|
||||||
onTouchModeChange: (t) {
|
|
||||||
gFFI.ffiModel.toggleTouchMode();
|
|
||||||
final v = gFFI.ffiModel.touchMode ? 'Y' : '';
|
|
||||||
bind.sessionPeerOption(
|
|
||||||
id: widget.id, name: "touch", value: v);
|
|
||||||
}));
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * Currently mobile does not enable map mode
|
// * Currently mobile does not enable map mode
|
||||||
@ -719,6 +718,7 @@ class _KeyHelpToolsState extends State<KeyHelpTools> {
|
|||||||
var _more = true;
|
var _more = true;
|
||||||
var _fn = false;
|
var _fn = false;
|
||||||
var _pin = false;
|
var _pin = false;
|
||||||
|
final _keyboardVisibilityController = KeyboardVisibilityController();
|
||||||
|
|
||||||
InputModel get inputModel => gFFI.inputModel;
|
InputModel get inputModel => gFFI.inputModel;
|
||||||
|
|
||||||
@ -863,7 +863,8 @@ class _KeyHelpToolsState extends State<KeyHelpTools> {
|
|||||||
final space = size.width > 320 ? 4.0 : 2.0;
|
final space = size.width > 320 ? 4.0 : 2.0;
|
||||||
return Container(
|
return Container(
|
||||||
color: Color(0xAA000000),
|
color: Color(0xAA000000),
|
||||||
padding: EdgeInsets.only(top: widget.requestShow ? 24 : 4, bottom: 8),
|
padding: EdgeInsets.only(
|
||||||
|
top: _keyboardVisibilityController.isVisible ? 24 : 4, bottom: 8),
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
spacing: space,
|
spacing: space,
|
||||||
runSpacing: space,
|
runSpacing: space,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user