From 71493c8e7e3d5ad904e59c0ad0c7aa4e41f84f41 Mon Sep 17 00:00:00 2001 From: open-trade Date: Sun, 29 Nov 2020 14:19:01 +0800 Subject: [PATCH] have to put easyloading on FlutterEasyLoading, if on scaffold, mouse not work --- flutter_hbb/lib/remote_page.dart | 195 ++++++++++++++++--------------- flutter_hbb/pubspec.lock | 8 +- flutter_hbb/pubspec.yaml | 6 +- 3 files changed, 104 insertions(+), 105 deletions(-) diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index 69f4a9948..1838d40d9 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -165,82 +165,81 @@ class _RemotePageState extends State { Widget build(BuildContext context) { EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; return WillPopScope( - onWillPop: () async { - close(); - return false; - }, - 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( + onWillPop: () async { + 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( color: Colors.white, - icon: Icon(Icons.clear), + icon: Icon(Icons.mouse), onPressed: () { - close(); + setState(() { + _mouseTools = !_mouseTools; + resetTool(); + }); }, - ), - 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( + )), + 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: FlutterEasyLoading( + child: GestureDetector( onTap: () { if (_drag || _scroll) return; FFI.tap(_right); @@ -288,30 +287,32 @@ class _RemotePageState extends State { 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, - ), - ), - ]), - )), - )); + 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, + ), + ), + ]))), + )), + ); } void close() { diff --git a/flutter_hbb/pubspec.lock b/flutter_hbb/pubspec.lock index c5f42abad..7b0a5a1c7 100644 --- a/flutter_hbb/pubspec.lock +++ b/flutter_hbb/pubspec.lock @@ -149,11 +149,9 @@ packages: flutter_easyloading: dependency: "direct main" description: - path: "." - ref: HEAD - resolved-ref: "2d085c411dc262043b6173c3b962d3e66ce657b1" - url: "git://github.com/open-trade/flutter_easyloading" - source: git + path: flutter_easyloading + relative: true + source: path version: "2.2.0" flutter_spinkit: dependency: transitive diff --git a/flutter_hbb/pubspec.yaml b/flutter_hbb/pubspec.yaml index 598abcf5a..fa8384bbf 100644 --- a/flutter_hbb/pubspec.yaml +++ b/flutter_hbb/pubspec.yaml @@ -32,9 +32,9 @@ dependencies: path_provider: ^1.6.24 provider: ^4.3.2+2 flutter_easyloading: - git: - url: git://github.com/open-trade/flutter_easyloading - #path: flutter_easyloading + #git: + #url: git://github.com/open-trade/flutter_easyloading + path: flutter_easyloading tuple: ^1.0.1 wakelock: ^0.2.1+1 device_info: ^1.0.0