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

View File

@ -35,8 +35,7 @@ class _RemotePageState extends State<RemotePage> {
var _drag = false;
var _right = false;
var _scroll = false;
var _arrows = false;
var _more = false;
var _more = true;
var _fn = false;
final FocusNode _focusNode = FocusNode();
var _showEdit = true;
@ -354,7 +353,8 @@ class _RemotePageState extends State<RemotePage> {
(String text, void Function() onPressed, [bool active, IconData icon]) {
return ButtonTheme(
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
.shrinkWrap, //limits the touch area to the button area
minWidth: 0, //wraps child's width
@ -366,7 +366,7 @@ class _RemotePageState extends State<RemotePage> {
),
color: active == true ? MyTheme.accent80 : null,
child: icon != null
? Icon(icon, color: Colors.white)
? Icon(icon, size: 17, color: Colors.white)
: Text(text,
style: TextStyle(color: Colors.white, fontSize: 11)),
onPressed: onPressed));
@ -415,25 +415,12 @@ class _RemotePageState extends State<RemotePage> {
}, FFI.command),
];
final keys = <Widget>[
wrap(
'Arrows',
() => setState(() {
setState(() {
_arrows = !_arrows;
if (_arrows) {
_fn = false;
_more = false;
}
});
}),
_arrows),
wrap(
'Fn',
() => setState(
() {
_fn = !_fn;
if (_fn) {
_arrows = false;
_more = false;
}
},
@ -445,28 +432,12 @@ class _RemotePageState extends State<RemotePage> {
() {
_more = !_more;
if (_more) {
_arrows = false;
_fn = false;
}
},
),
_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>[
SizedBox(width: 9999),
];
@ -499,6 +470,35 @@ class _RemotePageState extends State<RemotePage> {
wrap('PgDown', () {
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(
color: Color(0xAA000000),
@ -509,11 +509,7 @@ class _RemotePageState extends State<RemotePage> {
runSpacing: 4,
children: <Widget>[SizedBox(width: 9999)] +
(keyboard
? modifiers +
keys +
(_arrows ? arrows : []) +
(_fn ? fn : []) +
(_more ? more : [])
? modifiers + keys + (_fn ? fn : []) + (_more ? more : [])
: mouse + modifiers),
));
}