diff --git a/flutter_hbb/lib/common.dart b/flutter_hbb/lib/common.dart index acdf11e8b..6a1ada3fc 100644 --- a/flutter_hbb/lib/common.dart +++ b/flutter_hbb/lib/common.dart @@ -13,7 +13,6 @@ class MyTheme { static const Color border = Color(0xFFCCCCCC); } -// https://github.com/huangjianke/flutter_easyloading void showLoading(String text) { dismissLoading(); EasyLoading.show(status: text); @@ -32,7 +31,6 @@ bool _hasDialog = false; typedef BuildAlertDailog = Tuple3> Function( void Function(void Function())); -// https://material.io/develop/flutter/components/dialogs Future showAlertDialog(BuildContext context, BuildAlertDailog build, [WillPopCallback onWillPop, bool barrierDismissible = false, diff --git a/flutter_hbb/lib/model.dart b/flutter_hbb/lib/model.dart index 3a3812c41..f976769f4 100644 --- a/flutter_hbb/lib/model.dart +++ b/flutter_hbb/lib/model.dart @@ -22,7 +22,6 @@ typedef F3 = void Function(Pointer, Pointer); typedef F4 = void Function(Pointer); typedef F5 = Pointer Function(); -// https://juejin.im/post/6844903864852807694 class FfiModel with ChangeNotifier { PeerInfo _pi; Display _display; @@ -63,6 +62,7 @@ class FfiModel with ChangeNotifier { BuildContext context, void Function(Map evt, String id, BuildContext context) handleMsgbox) { + var pos; for (;;) { var evt = FFI.popEvent(); if (evt == null) break; @@ -78,11 +78,12 @@ class FfiModel with ChangeNotifier { } else if (name == 'cursor_id') { FFI.cursorModel.updateCursorId(evt); } else if (name == 'cursor_position') { - FFI.cursorModel.updateCursorPosition(evt); + pos = evt; } else if (name == 'permission') { FFI.ffiModel.updatePermission(evt); } } + if (pos != null) FFI.cursorModel.updateCursorPosition(pos); if (!_decoding) { var rgba = FFI.getRgba(); if (rgba != null) { @@ -343,7 +344,6 @@ class FFI { var p = _getByName(Utf8.toUtf8(name), Utf8.toUtf8(arg)); assert(p != nullptr && p != null); var res = Utf8.fromUtf8(p); - // https://github.com/brickpop/flutter-rust-ffi _freeCString(p); return res; } diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index fdce55b5a..ee38e3e97 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -19,7 +19,6 @@ class RemotePage extends StatefulWidget { _RemotePageState createState() => _RemotePageState(); } -// https://github.com/hanxu317317/flutter_plan_demo/blob/master/lib/src/enter.dart class _RemotePageState extends State { Timer _interval; bool _showBar = true; @@ -34,7 +33,6 @@ class _RemotePageState extends State { super.initState(); FFI.connect(widget.id); WidgetsBinding.instance.addPostFrameCallback((_) { - // https://stackoverflow.com/questions/46640116/make-flutter-application-fullscreen SystemChrome.setEnabledSystemUIOverlays([]); showLoading('Connecting...'); _interval = @@ -82,8 +80,8 @@ class _RemotePageState extends State { @override Widget build(BuildContext context) { - // Size size = MediaQueryData.fromWindow(ui.window).size; - // MediaQuery.of(context).size.height; + print('${MediaQueryData.fromWindow(ui.window).size}'); + print('${MediaQuery.of(context).size}'); EasyLoading.instance.loadingStyle = EasyLoadingStyle.light; return WillPopScope( onWillPop: () async {