This commit is contained in:
open-trade 2020-11-23 23:52:30 +08:00
parent f86673ebcb
commit 23f1ce5da5
3 changed files with 5 additions and 9 deletions

View File

@ -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<Widget, Widget, List<Widget>> Function(
void Function(void Function()));
// https://material.io/develop/flutter/components/dialogs
Future<T> showAlertDialog<T>(BuildContext context, BuildAlertDailog build,
[WillPopCallback onWillPop,
bool barrierDismissible = false,

View File

@ -22,7 +22,6 @@ typedef F3 = void Function(Pointer<Utf8>, Pointer<Utf8>);
typedef F4 = void Function(Pointer<RgbaFrame>);
typedef F5 = Pointer<RgbaFrame> 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<String, dynamic> 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;
}

View File

@ -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<RemotePage> {
Timer _interval;
bool _showBar = true;
@ -34,7 +33,6 @@ class _RemotePageState extends State<RemotePage> {
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<RemotePage> {
@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 {