input key ffi
This commit is contained in:
parent
ae79afaf0d
commit
83622cffc6
@ -16,6 +16,7 @@ class HexColor extends Color {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyTheme {
|
class MyTheme {
|
||||||
|
MyTheme._();
|
||||||
static const Color grayBg = Color(0xFFEEEEEE);
|
static const Color grayBg = Color(0xFFEEEEEE);
|
||||||
static const Color white = Color(0xFFFFFFFF);
|
static const Color white = Color(0xFFFFFFFF);
|
||||||
static const Color accent = Color(0xFF0071FF);
|
static const Color accent = Color(0xFF0071FF);
|
||||||
@ -46,7 +47,7 @@ typedef BuildAlertDailog = Tuple3<Widget, Widget, List<Widget>> Function(
|
|||||||
// https://material.io/develop/flutter/components/dialogs
|
// https://material.io/develop/flutter/components/dialogs
|
||||||
Future<T> showAlertDialog<T>(BuildContext context, BuildAlertDailog build,
|
Future<T> showAlertDialog<T>(BuildContext context, BuildAlertDailog build,
|
||||||
[WillPopCallback onWillPop,
|
[WillPopCallback onWillPop,
|
||||||
bool barrierDismissible,
|
bool barrierDismissible = false,
|
||||||
double contentPadding = 20]) async {
|
double contentPadding = 20]) async {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
if (_hasDialog) {
|
if (_hasDialog) {
|
||||||
@ -73,10 +74,20 @@ Future<T> showAlertDialog<T>(BuildContext context, BuildAlertDailog build,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void msgbox(String type, String title, String text, BuildContext context) {
|
void msgbox(String type, String title, String text, BuildContext context,
|
||||||
|
[hasCancel = false]) {
|
||||||
showAlertDialog(
|
showAlertDialog(
|
||||||
context,
|
context,
|
||||||
(_) => Tuple3(Text(title), Text(text), [
|
(_) => Tuple3(Text(title), Text(text), [
|
||||||
|
hasCancel
|
||||||
|
? Spacer()
|
||||||
|
: FlatButton(
|
||||||
|
textColor: MyTheme.accent,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text('Cancel'),
|
||||||
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
textColor: MyTheme.accent,
|
textColor: MyTheme.accent,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
@ -267,7 +267,7 @@ class FFI {
|
|||||||
FFI.ffiModel.clear();
|
FFI.ffiModel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setByName(String name, String value) {
|
static void setByName(String name, [String value = '']) {
|
||||||
_setByName(Utf8.toUtf8(name), Utf8.toUtf8(value));
|
_setByName(Utf8.toUtf8(name), Utf8.toUtf8(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,12 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
||||||
// MediaQuery.of(context).size.height;
|
// MediaQuery.of(context).size.height;
|
||||||
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
close();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
floatingActionButton: _showBar
|
floatingActionButton: _showBar
|
||||||
? null
|
? null
|
||||||
: FloatingActionButton(
|
: FloatingActionButton(
|
||||||
@ -88,7 +93,9 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.clear),
|
icon: Icon(Icons.clear),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
close();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -100,13 +107,15 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
child: IconButton(
|
child: IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.flash_on),
|
icon: Icon(Icons.flash_on),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
showActions(context);
|
||||||
|
},
|
||||||
)),
|
)),
|
||||||
IconButton(
|
IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.tv),
|
icon: Icon(Icons.tv),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showOptions(widget.id, context);
|
showOptions(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@ -139,7 +148,11 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
CursorPaint(),
|
CursorPaint(),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
)));
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
|
void close() {
|
||||||
|
msgbox('', 'Close', 'Are you sure to close the connection?', context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +274,7 @@ void wrongPasswordDialog(String id, BuildContext context) {
|
|||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void showOptions(String id, BuildContext context) {
|
void showOptions(BuildContext context) {
|
||||||
var showRemoteCursor =
|
var showRemoteCursor =
|
||||||
FFI.getByName('toggle_option', 'show-remote-cursor') == 'true';
|
FFI.getByName('toggle_option', 'show-remote-cursor') == 'true';
|
||||||
var lockAfterSessionEnd =
|
var lockAfterSessionEnd =
|
||||||
@ -332,5 +345,32 @@ void showOptions(String id, BuildContext context) {
|
|||||||
null),
|
null),
|
||||||
() async => true,
|
() async => true,
|
||||||
true,
|
true,
|
||||||
10);
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showActions(BuildContext context) {
|
||||||
|
showAlertDialog(
|
||||||
|
context,
|
||||||
|
(setState) => Tuple3(
|
||||||
|
null,
|
||||||
|
Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
FFI.setByName('ctrl_alt_del');
|
||||||
|
},
|
||||||
|
title: Text('Insert Ctrl + Alt + Del'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
FFI.setByName('lock_screen');
|
||||||
|
},
|
||||||
|
title: Text('Insert Lock'),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
null),
|
||||||
|
() async => true,
|
||||||
|
true,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user