have to put easyloading on FlutterEasyLoading, if on scaffold, mouse not

work
This commit is contained in:
open-trade 2020-11-29 14:19:01 +08:00
parent ac4b14292d
commit 71493c8e7e
3 changed files with 104 additions and 105 deletions

View File

@ -165,82 +165,81 @@ class _RemotePageState extends State<RemotePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
return WillPopScope( return WillPopScope(
onWillPop: () async { onWillPop: () async {
close(); close();
return false; return false;
}, },
child: FlutterEasyLoading( child: Scaffold(
child: Scaffold( floatingActionButton: _showBar
backgroundColor: MyTheme.canvasColor, ? null
floatingActionButton: _showBar : FloatingActionButton(
? null mini: true,
: FloatingActionButton( child: Icon(Icons.expand_less),
mini: true, backgroundColor: MyTheme.accent50,
child: Icon(Icons.expand_less), onPressed: () {
backgroundColor: MyTheme.accent50, setState(() => _showBar = !_showBar);
onPressed: () { }),
setState(() => _showBar = !_showBar); bottomNavigationBar: _showBar && FFI.ffiModel.pi.displays != null
}), ? BottomAppBar(
bottomNavigationBar: _showBar && FFI.ffiModel.pi.displays != null elevation: 10,
? BottomAppBar( color: MyTheme.accent,
elevation: 10, child: Row(
color: MyTheme.accent, mainAxisSize: MainAxisSize.max,
child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max, children: <Widget>[
mainAxisAlignment: MainAxisAlignment.spaceBetween, Row(children: [
children: <Widget>[ IconButton(
Row(children: [ color: Colors.white,
IconButton( 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, color: Colors.white,
icon: Icon(Icons.clear), icon: Icon(Icons.mouse),
onPressed: () { onPressed: () {
close(); setState(() {
_mouseTools = !_mouseTools;
resetTool();
});
}, },
), )),
IconButton( IconButton(
color: Colors.white, color: Colors.white,
icon: Icon(Icons.keyboard), icon: Icon(Icons.more_vert),
onPressed: openKeyboard), onPressed: () {
IconButton( setState(() => _showEdit = false);
color: Colors.white, showActions(context);
icon: Icon(Icons.tv), },
onPressed: () { ),
setState(() => _showEdit = false); ]),
showOptions(context); IconButton(
}, color: Colors.white,
), icon: Icon(Icons.expand_more),
Container( onPressed: () {
color: _mouseTools ? Colors.blue[500] : null, setState(() => _showBar = !_showBar);
child: IconButton( }),
color: Colors.white, ],
icon: Icon(Icons.mouse), ),
onPressed: () { )
setState(() { : null,
_mouseTools = !_mouseTools; body: FlutterEasyLoading(
resetTool(); child: 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: GestureDetector(
onTap: () { onTap: () {
if (_drag || _scroll) return; if (_drag || _scroll) return;
FFI.tap(_right); FFI.tap(_right);
@ -288,30 +287,32 @@ class _RemotePageState extends State<RemotePage> {
FFI.sendMouse('up', 'left'); FFI.sendMouse('up', 'left');
} }
}, },
child: Stack(children: [ child: Container(
ImagePaint(), color: MyTheme.canvasColor,
CursorPaint(), child: Stack(children: [
getHelpTools(), ImagePaint(),
SizedBox( CursorPaint(),
width: 0, getHelpTools(),
height: 0, SizedBox(
child: !_showEdit width: 0,
? Container() height: 0,
: TextFormField( child: !_showEdit
textInputAction: TextInputAction.newline, ? Container()
autocorrect: false, : TextFormField(
enableSuggestions: false, textInputAction: TextInputAction.newline,
focusNode: _focusNode, autocorrect: false,
maxLines: null, enableSuggestions: false,
initialValue: focusNode: _focusNode,
_value, // trick way to make backspace work always maxLines: null,
keyboardType: TextInputType.multiline, initialValue:
onChanged: handleInput, _value, // trick way to make backspace work always
), keyboardType: TextInputType.multiline,
), onChanged: handleInput,
]), ),
)), ),
)); ]))),
)),
);
} }
void close() { void close() {

View File

@ -149,11 +149,9 @@ packages:
flutter_easyloading: flutter_easyloading:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: flutter_easyloading
ref: HEAD relative: true
resolved-ref: "2d085c411dc262043b6173c3b962d3e66ce657b1" source: path
url: "git://github.com/open-trade/flutter_easyloading"
source: git
version: "2.2.0" version: "2.2.0"
flutter_spinkit: flutter_spinkit:
dependency: transitive dependency: transitive

View File

@ -32,9 +32,9 @@ dependencies:
path_provider: ^1.6.24 path_provider: ^1.6.24
provider: ^4.3.2+2 provider: ^4.3.2+2
flutter_easyloading: flutter_easyloading:
git: #git:
url: git://github.com/open-trade/flutter_easyloading #url: git://github.com/open-trade/flutter_easyloading
#path: flutter_easyloading path: flutter_easyloading
tuple: ^1.0.1 tuple: ^1.0.1
wakelock: ^0.2.1+1 wakelock: ^0.2.1+1
device_info: ^1.0.0 device_info: ^1.0.0