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