diff --git a/lib/main.dart b/lib/main.dart index 0e2471908..32bd1a3d2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,7 +11,7 @@ import 'server_page.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); - // EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; + EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; toAndroidChannelInit(); runApp(App()); } diff --git a/lib/remote_page.dart b/lib/remote_page.dart index 64814b03f..7271340a8 100644 --- a/lib/remote_page.dart +++ b/lib/remote_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_hbb/widgets/gesture_help.dart'; import 'package:provider/provider.dart'; import 'package:flutter/services.dart'; @@ -41,7 +42,7 @@ class _RemotePageState extends State { super.initState(); FFI.connect(widget.id); WidgetsBinding.instance!.addPostFrameCallback((_) { - SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); showLoading(translate('Connecting...'), context); _interval = Timer.periodic(Duration(milliseconds: 30), (timer) => interval()); @@ -57,7 +58,8 @@ class _RemotePageState extends State { _interval?.cancel(); _timer?.cancel(); dismissLoading(); - SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, + overlays: SystemUiOverlay.values); Wakelock.disable(); super.dispose(); } @@ -70,7 +72,7 @@ class _RemotePageState extends State { return _bottom >= 100; } - // crash on web before widgit initiated. + // crash on web before widget initiated. void intervalUnsafe() { var v = MediaQuery.of(context).viewInsets.bottom; if (v != _bottom) { @@ -78,11 +80,12 @@ class _RemotePageState extends State { setState(() { _bottom = v; if (v < 100) { - SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, + overlays: []); } }); } - FFI.ffiModel.update(widget.id, context, handleMsgbox); + FFI.ffiModel.update(widget.id, context, handleMsgBox); } void interval() { @@ -91,7 +94,7 @@ class _RemotePageState extends State { } catch (e) {} } - void handleMsgbox(Map evt, String id) { + void handleMsgBox(Map evt, String id) { var type = evt['type']; var title = evt['title']; var text = evt['text']; @@ -208,7 +211,8 @@ class _RemotePageState extends State { setState(() => _showEdit = true); _timer?.cancel(); _timer = Timer(Duration(milliseconds: 30), () { - SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, + overlays: SystemUiOverlay.values); SystemChannels.textInput.invokeMethod('TextInput.show'); _focusNode.requestFocus(); }); @@ -245,12 +249,17 @@ class _RemotePageState extends State { }), bottomNavigationBar: _showBar && pi.displays != null ? getBottomAppBar() : null, - body: Container( - color: Colors.black, - child: isDesktop - ? getBodyForDesktopWithListener() - : SafeArea(child: getBodyForMobileWithGesture())), - ), + body: Overlay( + initialEntries: [ + OverlayEntry(builder: (context) { + return Container( + color: Colors.black, + child: isDesktop + ? getBodyForDesktopWithListener() + : SafeArea(child: getBodyForMobileWithGesture())); + }) + ], + )), ); }