fixed on refresh(reset origin and scaled), and move arrows to more,

smaller padding, to-do: scale restore not working
This commit is contained in:
open-trade 2020-12-24 10:44:44 +08:00
parent 5d5097eccd
commit 130104a475
2 changed files with 37 additions and 39 deletions

View File

@ -159,11 +159,13 @@ class FfiModel with ChangeNotifier {
} }
void handleSwitchDisplay(Map<String, dynamic> evt) { void handleSwitchDisplay(Map<String, dynamic> evt) {
var old = _pi.currentDisplay;
_pi.currentDisplay = int.parse(evt['display']); _pi.currentDisplay = int.parse(evt['display']);
_display.x = double.parse(evt['x']); _display.x = double.parse(evt['x']);
_display.y = double.parse(evt['y']); _display.y = double.parse(evt['y']);
_display.width = int.parse(evt['width']); _display.width = int.parse(evt['width']);
_display.height = int.parse(evt['height']); _display.height = int.parse(evt['height']);
if (old != _pi.currentDisplay)
FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y); FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y);
notifyListeners(); notifyListeners();
} }

View File

@ -35,8 +35,7 @@ class _RemotePageState extends State<RemotePage> {
var _drag = false; var _drag = false;
var _right = false; var _right = false;
var _scroll = false; var _scroll = false;
var _arrows = false; var _more = true;
var _more = false;
var _fn = false; var _fn = false;
final FocusNode _focusNode = FocusNode(); final FocusNode _focusNode = FocusNode();
var _showEdit = true; var _showEdit = true;
@ -354,7 +353,8 @@ class _RemotePageState extends State<RemotePage> {
(String text, void Function() onPressed, [bool active, IconData icon]) { (String text, void Function() onPressed, [bool active, IconData icon]) {
return ButtonTheme( return ButtonTheme(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 6, horizontal: 11), //adds padding inside the button vertical: icon != null ? 3 : 6,
horizontal: 6), //adds padding inside the button
materialTapTargetSize: MaterialTapTargetSize materialTapTargetSize: MaterialTapTargetSize
.shrinkWrap, //limits the touch area to the button area .shrinkWrap, //limits the touch area to the button area
minWidth: 0, //wraps child's width minWidth: 0, //wraps child's width
@ -366,7 +366,7 @@ class _RemotePageState extends State<RemotePage> {
), ),
color: active == true ? MyTheme.accent80 : null, color: active == true ? MyTheme.accent80 : null,
child: icon != null child: icon != null
? Icon(icon, color: Colors.white) ? Icon(icon, size: 17, color: Colors.white)
: Text(text, : Text(text,
style: TextStyle(color: Colors.white, fontSize: 11)), style: TextStyle(color: Colors.white, fontSize: 11)),
onPressed: onPressed)); onPressed: onPressed));
@ -415,25 +415,12 @@ class _RemotePageState extends State<RemotePage> {
}, FFI.command), }, FFI.command),
]; ];
final keys = <Widget>[ final keys = <Widget>[
wrap(
'Arrows',
() => setState(() {
setState(() {
_arrows = !_arrows;
if (_arrows) {
_fn = false;
_more = false;
}
});
}),
_arrows),
wrap( wrap(
'Fn', 'Fn',
() => setState( () => setState(
() { () {
_fn = !_fn; _fn = !_fn;
if (_fn) { if (_fn) {
_arrows = false;
_more = false; _more = false;
} }
}, },
@ -445,28 +432,12 @@ class _RemotePageState extends State<RemotePage> {
() { () {
_more = !_more; _more = !_more;
if (_more) { if (_more) {
_arrows = false;
_fn = false; _fn = false;
} }
}, },
), ),
_more), _more),
]; ];
final arrows = <Widget>[
SizedBox(width: 9999),
wrap('', () {
FFI.inputKey('VK_LEFT');
}, false, Icons.keyboard_arrow_left),
wrap('', () {
FFI.inputKey('VK_UP');
}, false, Icons.keyboard_arrow_up),
wrap('', () {
FFI.inputKey('VK_DOWN');
}, false, Icons.keyboard_arrow_down),
wrap('', () {
FFI.inputKey('VK_RIGHT');
}, false, Icons.keyboard_arrow_right),
];
final fn = <Widget>[ final fn = <Widget>[
SizedBox(width: 9999), SizedBox(width: 9999),
]; ];
@ -499,6 +470,35 @@ class _RemotePageState extends State<RemotePage> {
wrap('PgDown', () { wrap('PgDown', () {
FFI.inputKey('VK_NEXT'); FFI.inputKey('VK_NEXT');
}), }),
SizedBox(width: 9999),
wrap('', () {
FFI.inputKey('VK_LEFT');
}, false, Icons.keyboard_arrow_left),
wrap('', () {
FFI.inputKey('VK_UP');
}, false, Icons.keyboard_arrow_up),
wrap('', () {
FFI.inputKey('VK_DOWN');
}, false, Icons.keyboard_arrow_down),
wrap('', () {
FFI.inputKey('VK_RIGHT');
}, false, Icons.keyboard_arrow_right),
wrap('Ctrl+C', () {
var old = FFI.ctrl;
FFI.ctrl = true;
FFI.inputKey(
'VK_C',
);
FFI.ctrl = old;
}),
wrap('Ctrl+S', () {
var old = FFI.ctrl;
FFI.ctrl = true;
FFI.inputKey(
'VK_S',
);
FFI.ctrl = old;
}),
]; ];
return Container( return Container(
color: Color(0xAA000000), color: Color(0xAA000000),
@ -509,11 +509,7 @@ class _RemotePageState extends State<RemotePage> {
runSpacing: 4, runSpacing: 4,
children: <Widget>[SizedBox(width: 9999)] + children: <Widget>[SizedBox(width: 9999)] +
(keyboard (keyboard
? modifiers + ? modifiers + keys + (_fn ? fn : []) + (_more ? more : [])
keys +
(_arrows ? arrows : []) +
(_fn ? fn : []) +
(_more ? more : [])
: mouse + modifiers), : mouse + modifiers),
)); ));
} }