permissions
This commit is contained in:
parent
f6f7e1ead1
commit
364fb78084
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:html';
|
||||||
|
|
||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@ -23,22 +25,35 @@ typedef F5 = Pointer<RgbaFrame> Function();
|
|||||||
|
|
||||||
// https://juejin.im/post/6844903864852807694
|
// https://juejin.im/post/6844903864852807694
|
||||||
class FfiModel with ChangeNotifier {
|
class FfiModel with ChangeNotifier {
|
||||||
PeerInfo _pi = PeerInfo();
|
PeerInfo _pi;
|
||||||
Display _display = Display();
|
Display _display;
|
||||||
bool _decoding = false;
|
bool _decoding;
|
||||||
bool _waitForImage = false;
|
bool _waitForImage;
|
||||||
|
final _permissions = Map<String, bool>();
|
||||||
|
|
||||||
|
get permissions => _permissions;
|
||||||
|
|
||||||
FfiModel() {
|
FfiModel() {
|
||||||
init();
|
clear();
|
||||||
|
() async {
|
||||||
|
await FFI.init();
|
||||||
|
notifyListeners();
|
||||||
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> init() async {
|
void updatePermission(Map<String, dynamic> evt) {
|
||||||
await FFI.init();
|
evt.forEach((k, v) {
|
||||||
notifyListeners();
|
if (k == 'name') return;
|
||||||
|
_permissions[k] = v == 'true';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
_pi = PeerInfo();
|
||||||
|
_display = Display();
|
||||||
_decoding = false;
|
_decoding = false;
|
||||||
|
_waitForImage = false;
|
||||||
|
_permissions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(
|
void update(
|
||||||
@ -62,6 +77,8 @@ class FfiModel with ChangeNotifier {
|
|||||||
FFI.cursorModel.updateCursorId(evt);
|
FFI.cursorModel.updateCursorId(evt);
|
||||||
} else if (name == 'cursor_position') {
|
} else if (name == 'cursor_position') {
|
||||||
FFI.cursorModel.updateCursorPosition(evt);
|
FFI.cursorModel.updateCursorPosition(evt);
|
||||||
|
} else if (name == 'permission') {
|
||||||
|
FFI.ffiModel.updatePermission(evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_decoding) {
|
if (!_decoding) {
|
||||||
|
@ -76,10 +76,6 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleKeyEvent(RawKeyEvent event) {
|
|
||||||
print('$event');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
||||||
@ -210,7 +206,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
height: 0,
|
height: 0,
|
||||||
child: _bottom < 100
|
child: _bottom < 100
|
||||||
? Container()
|
? Container()
|
||||||
: TextFormField(
|
: TextField(
|
||||||
textInputAction: TextInputAction.newline,
|
textInputAction: TextInputAction.newline,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user