refactor and prepare for desktop
This commit is contained in:
parent
3e7c20f303
commit
502f0c7e9d
@ -258,8 +258,20 @@ class _RemotePageState extends State<RemotePage> {
|
||||
}
|
||||
});
|
||||
}),
|
||||
bottomNavigationBar: _showBar && pi.displays != null
|
||||
? BottomAppBar(
|
||||
bottomNavigationBar:
|
||||
_showBar && pi.displays != null ? getBottomAppBar() : null,
|
||||
body: FlutterEasyLoading(
|
||||
child: Container(
|
||||
color: Colors.black,
|
||||
child: isDesktop
|
||||
? getBodyForDesktop()
|
||||
: SafeArea(child: getBodyForMobile())),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getBottomAppBar() {
|
||||
return BottomAppBar(
|
||||
elevation: 10,
|
||||
color: MyTheme.accent,
|
||||
child: Row(
|
||||
@ -298,9 +310,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
? []
|
||||
: [
|
||||
Container(
|
||||
color: _mouseTools
|
||||
? Colors.blue[500]
|
||||
: null,
|
||||
color: _mouseTools ? Colors.blue[500] : null,
|
||||
child: IconButton(
|
||||
color: Colors.white,
|
||||
icon: Icon(Icons.mouse),
|
||||
@ -331,13 +341,11 @@ class _RemotePageState extends State<RemotePage> {
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
: null,
|
||||
body: FlutterEasyLoading(
|
||||
child: Container(
|
||||
color: Colors.black,
|
||||
child: SafeArea(
|
||||
child: GestureDetector(
|
||||
);
|
||||
}
|
||||
|
||||
Widget getBodyForMobile() {
|
||||
return GestureDetector(
|
||||
onLongPress: () {
|
||||
if (_drag || _scroll) return;
|
||||
// make right click and real left long click both work
|
||||
@ -351,8 +359,8 @@ class _RemotePageState extends State<RemotePage> {
|
||||
onTapUp: (details) {
|
||||
if (_drag || _scroll) return;
|
||||
if (_touchMode) {
|
||||
FFI.cursorModel.touch(details.localPosition.dx,
|
||||
details.localPosition.dy, _right);
|
||||
FFI.cursorModel.touch(
|
||||
details.localPosition.dx, details.localPosition.dy, _right);
|
||||
} else {
|
||||
FFI.tap(_right);
|
||||
}
|
||||
@ -373,8 +381,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
var y = details.focalPoint.dy;
|
||||
var dx = x - _xOffset;
|
||||
var dy = y - _yOffset;
|
||||
FFI.cursorModel
|
||||
.updatePan(dx, dy, _touchMode, _drag);
|
||||
FFI.cursorModel.updatePan(dx, dy, _touchMode, _drag);
|
||||
_xOffset = x;
|
||||
_yOffset = y;
|
||||
} else {
|
||||
@ -411,8 +418,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
child: !_showEdit
|
||||
? Container()
|
||||
: TextFormField(
|
||||
textInputAction:
|
||||
TextInputAction.newline,
|
||||
textInputAction: TextInputAction.newline,
|
||||
autocorrect: false,
|
||||
enableSuggestions: false,
|
||||
focusNode: _focusNode,
|
||||
@ -423,9 +429,16 @@ class _RemotePageState extends State<RemotePage> {
|
||||
onChanged: handleInput,
|
||||
),
|
||||
),
|
||||
]))))),
|
||||
)),
|
||||
);
|
||||
])));
|
||||
}
|
||||
|
||||
Widget getBodyForDesktop() {
|
||||
return GestureDetector(
|
||||
onTapDown: (details) => {},
|
||||
onTapUp: (details) => {},
|
||||
child: Container(
|
||||
color: MyTheme.canvasColor,
|
||||
child: Stack(children: [ImagePaint(), CursorPaint()])));
|
||||
}
|
||||
|
||||
void showActions(BuildContext context) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user