diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index f814339a4..69f4a9948 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -169,148 +169,147 @@ class _RemotePageState extends State { close(); return false; }, - child: Scaffold( - floatingActionButton: _showBar - ? null - : FloatingActionButton( - mini: true, - child: Icon(Icons.expand_less), - backgroundColor: MyTheme.accent50, - onPressed: () { - setState(() => _showBar = !_showBar); - }), - bottomNavigationBar: _showBar && FFI.ffiModel.pi.displays != null - ? BottomAppBar( - elevation: 10, - color: MyTheme.accent, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row(children: [ - IconButton( - color: Colors.white, - icon: Icon(Icons.clear), - onPressed: () { - close(); - }, - ), - IconButton( - color: Colors.white, - icon: Icon(Icons.keyboard), - onPressed: openKeyboard), - IconButton( - color: Colors.white, - icon: Icon(Icons.tv), - onPressed: () { - setState(() => _showEdit = false); - showOptions(context); - }, - ), - Container( - color: _mouseTools ? Colors.blue[500] : null, - child: IconButton( + child: FlutterEasyLoading( + child: Scaffold( + backgroundColor: MyTheme.canvasColor, + floatingActionButton: _showBar + ? null + : FloatingActionButton( + mini: true, + child: Icon(Icons.expand_less), + backgroundColor: MyTheme.accent50, + onPressed: () { + setState(() => _showBar = !_showBar); + }), + bottomNavigationBar: _showBar && FFI.ffiModel.pi.displays != null + ? BottomAppBar( + elevation: 10, + color: MyTheme.accent, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row(children: [ + IconButton( color: Colors.white, - icon: Icon(Icons.mouse), + icon: Icon(Icons.clear), onPressed: () { - setState(() { - _mouseTools = !_mouseTools; - resetTool(); - }); + close(); }, - )), - IconButton( - color: Colors.white, - icon: Icon(Icons.more_vert), - onPressed: () { - setState(() => _showEdit = false); - showActions(context); - }, - ), - ]), - IconButton( - color: Colors.white, - icon: Icon(Icons.expand_more), - onPressed: () { - setState(() => _showBar = !_showBar); - }), - ], - ), - ) - : null, - body: GestureDetector( - onTap: () { - if (_drag || _scroll) return; - FFI.tap(_right); - }, - onLongPressStart: (_) { - if (_drag) { - // case: to show password on windows - FFI.sendMouse('down', 'left'); - } - }, - onLongPressEnd: (_) { - if (_drag) { - FFI.sendMouse('up', 'left'); - } - }, - onScaleStart: (details) { - _scale = 1; - _xOffset = details.focalPoint.dx; - _yOffset = details.focalPoint.dy; - if (_drag) { - FFI.sendMouse('down', 'left'); - } - }, - onScaleUpdate: (details) { - var scale = details.scale; - if (scale == 1) { - var x = details.focalPoint.dx; - var y = details.focalPoint.dy; - var dx = x - _xOffset; - var dy = y - _yOffset; - if (_scroll) { - FFI.scroll(-dy); - } else { - FFI.cursorModel.updatePan(dx, dy); - } - _xOffset = x; - _yOffset = y; - } else if (!_drag && !_scroll) { - FFI.canvasModel.updateScale(scale / _scale); - _scale = scale; - } - }, - onScaleEnd: (_) { - if (_drag) { - FFI.sendMouse('up', 'left'); - } - }, - child: FlutterEasyLoading( - child: Container( - color: MyTheme.canvasColor, - child: Stack(children: [ - ImagePaint(), - CursorPaint(), - getHelpTools(), - SizedBox( - width: 0, - height: 0, - child: !_showEdit - ? Container() - : TextFormField( - textInputAction: TextInputAction.newline, - autocorrect: false, - enableSuggestions: false, - focusNode: _focusNode, - maxLines: null, - initialValue: - _value, // trick way to make backspace work always - keyboardType: TextInputType.multiline, - onChanged: handleInput, - ), + ), + IconButton( + color: Colors.white, + icon: Icon(Icons.keyboard), + onPressed: openKeyboard), + IconButton( + color: Colors.white, + icon: Icon(Icons.tv), + onPressed: () { + setState(() => _showEdit = false); + showOptions(context); + }, + ), + Container( + color: _mouseTools ? Colors.blue[500] : null, + child: IconButton( + color: Colors.white, + icon: Icon(Icons.mouse), + onPressed: () { + setState(() { + _mouseTools = !_mouseTools; + resetTool(); + }); + }, + )), + IconButton( + color: Colors.white, + icon: Icon(Icons.more_vert), + onPressed: () { + setState(() => _showEdit = false); + showActions(context); + }, + ), + ]), + IconButton( + color: Colors.white, + icon: Icon(Icons.expand_more), + onPressed: () { + setState(() => _showBar = !_showBar); + }), + ], ), - ])), + ) + : null, + body: GestureDetector( + onTap: () { + if (_drag || _scroll) return; + FFI.tap(_right); + }, + onLongPressStart: (_) { + if (_drag) { + // case: to show password on windows + FFI.sendMouse('down', 'left'); + } + }, + onLongPressEnd: (_) { + if (_drag) { + FFI.sendMouse('up', 'left'); + } + }, + onScaleStart: (details) { + _scale = 1; + _xOffset = details.focalPoint.dx; + _yOffset = details.focalPoint.dy; + if (_drag) { + FFI.sendMouse('down', 'left'); + } + }, + onScaleUpdate: (details) { + var scale = details.scale; + if (scale == 1) { + var x = details.focalPoint.dx; + var y = details.focalPoint.dy; + var dx = x - _xOffset; + var dy = y - _yOffset; + if (_scroll) { + FFI.scroll(-dy); + } else { + FFI.cursorModel.updatePan(dx, dy); + } + _xOffset = x; + _yOffset = y; + } else if (!_drag && !_scroll) { + FFI.canvasModel.updateScale(scale / _scale); + _scale = scale; + } + }, + onScaleEnd: (_) { + if (_drag) { + FFI.sendMouse('up', 'left'); + } + }, + child: Stack(children: [ + ImagePaint(), + CursorPaint(), + getHelpTools(), + SizedBox( + width: 0, + height: 0, + child: !_showEdit + ? Container() + : TextFormField( + textInputAction: TextInputAction.newline, + autocorrect: false, + enableSuggestions: false, + focusNode: _focusNode, + maxLines: null, + initialValue: + _value, // trick way to make backspace work always + keyboardType: TextInputType.multiline, + onChanged: handleInput, + ), + ), + ]), )), )); }