set image center when remote resolution is changed
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
c7fd38ed23
commit
a3643f53bf
@ -977,10 +977,10 @@ Future<bool> matchPeer(String searchText, Peer peer) async {
|
||||
|
||||
/// Get the image for the current [platform].
|
||||
Widget getPlatformImage(String platform, {double size = 50}) {
|
||||
platform = platform.toLowerCase();
|
||||
if (platform == 'mac os') {
|
||||
if (platform == kPeerPlatformMacOS) {
|
||||
platform = 'mac';
|
||||
} else if (platform != 'linux' && platform != 'android') {
|
||||
} else if (platform != kPeerPlatformLinux &&
|
||||
platform != kPeerPlatformAndroid) {
|
||||
platform = 'win';
|
||||
}
|
||||
return SvgPicture.asset('assets/$platform.svg', height: size, width: size);
|
||||
|
@ -5,6 +5,11 @@ import 'package:flutter_hbb/common.dart';
|
||||
|
||||
const double kDesktopRemoteTabBarHeight = 28.0;
|
||||
|
||||
const String kPeerPlatformWindows = "Windows";
|
||||
const String kPeerPlatformLinux = "Linux";
|
||||
const String kPeerPlatformMacOS = "Mac OS";
|
||||
const String kPeerPlatformAndroid = "Android";
|
||||
|
||||
/// [kAppTypeMain] used by 'Desktop Main Page' , 'Mobile (Client and Server)' , 'Desktop CM Page', "Install Page"
|
||||
const String kAppTypeMain = "main";
|
||||
const String kAppTypeDesktopRemote = "remote";
|
||||
|
@ -308,7 +308,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
dismissOnClicked: true,
|
||||
));
|
||||
|
||||
if (pi.platform == 'Linux' || pi.sasEnabled) {
|
||||
if (pi.platform == kPeerPlatformLinux || pi.sasEnabled) {
|
||||
menu.add(MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) => Text(
|
||||
'${translate("Insert")} Ctrl + Alt + Del',
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
|
||||
@ -170,14 +171,14 @@ RxString KBLayoutType = ''.obs;
|
||||
|
||||
String getLocalPlatformForKBLayoutType(String peerPlatform) {
|
||||
String localPlatform = '';
|
||||
if (peerPlatform != 'Mac OS') {
|
||||
if (peerPlatform != kPeerPlatformMacOS) {
|
||||
return localPlatform;
|
||||
}
|
||||
|
||||
if (Platform.isWindows) {
|
||||
localPlatform = 'Windows';
|
||||
localPlatform = kPeerPlatformWindows;
|
||||
} else if (Platform.isLinux) {
|
||||
localPlatform = 'Linux';
|
||||
localPlatform = kPeerPlatformLinux;
|
||||
}
|
||||
// to-do: web desktop support ?
|
||||
return localPlatform;
|
||||
|
@ -589,7 +589,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
}
|
||||
displayMenu.add(MenuEntryDivider());
|
||||
if (perms['keyboard'] != false) {
|
||||
if (pi.platform == 'Linux' || pi.sasEnabled) {
|
||||
if (pi.platform == kPeerPlatformLinux || pi.sasEnabled) {
|
||||
displayMenu.add(MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) => Text(
|
||||
'${translate("Insert")} Ctrl + Alt + Del',
|
||||
@ -604,9 +604,9 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
}
|
||||
}
|
||||
if (perms['restart'] != false &&
|
||||
(pi.platform == 'Linux' ||
|
||||
pi.platform == 'Windows' ||
|
||||
pi.platform == 'Mac OS')) {
|
||||
(pi.platform == kPeerPlatformLinux ||
|
||||
pi.platform == kPeerPlatformWindows ||
|
||||
pi.platform == kPeerPlatformMacOS)) {
|
||||
displayMenu.add(MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) => Text(
|
||||
translate('Restart Remote Device'),
|
||||
@ -633,7 +633,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
dismissOnClicked: true,
|
||||
));
|
||||
|
||||
if (pi.platform == 'Windows') {
|
||||
if (pi.platform == kPeerPlatformWindows) {
|
||||
displayMenu.add(MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) => Obx(() => Text(
|
||||
translate(
|
||||
@ -1157,7 +1157,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
}
|
||||
|
||||
if (Platform.isWindows &&
|
||||
pi.platform == 'Windows' &&
|
||||
pi.platform == kPeerPlatformWindows &&
|
||||
perms['file'] != false) {
|
||||
displayMenu.add(_createSwitchMenuEntry(
|
||||
'Allow file copy and paste', 'enable-file-transfer', padding, true));
|
||||
|
@ -574,14 +574,14 @@ class _RemotePageState extends State<RemotePage> {
|
||||
more.add(PopupMenuItem<String>(
|
||||
child: Text(translate('Physical Keyboard Input Mode')),
|
||||
value: 'input-mode'));
|
||||
if (pi.platform == 'Linux' || pi.sasEnabled) {
|
||||
if (pi.platform == kPeerPlatformLinux || pi.sasEnabled) {
|
||||
more.add(PopupMenuItem<String>(
|
||||
child: Text('${translate('Insert')} Ctrl + Alt + Del'),
|
||||
value: 'cad'));
|
||||
}
|
||||
more.add(PopupMenuItem<String>(
|
||||
child: Text(translate('Insert Lock')), value: 'lock'));
|
||||
if (pi.platform == 'Windows' &&
|
||||
if (pi.platform == kPeerPlatformWindows &&
|
||||
await bind.sessionGetToggleOption(id: id, arg: 'privacy-mode') !=
|
||||
true) {
|
||||
more.add(PopupMenuItem<String>(
|
||||
@ -591,9 +591,9 @@ class _RemotePageState extends State<RemotePage> {
|
||||
}
|
||||
}
|
||||
if (perms["restart"] != false &&
|
||||
(pi.platform == "Linux" ||
|
||||
pi.platform == "Windows" ||
|
||||
pi.platform == "Mac OS")) {
|
||||
(pi.platform == kPeerPlatformLinux ||
|
||||
pi.platform == kPeerPlatformWindows ||
|
||||
pi.platform == kPeerPlatformMacOS)) {
|
||||
more.add(PopupMenuItem<String>(
|
||||
child: Text(translate('Restart Remote Device')), value: 'restart'));
|
||||
}
|
||||
@ -740,7 +740,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
}
|
||||
|
||||
final pi = gFFI.ffiModel.pi;
|
||||
final isMac = pi.platform == "Mac OS";
|
||||
final isMac = pi.platform == kPeerPlatformMacOS;
|
||||
final modifiers = <Widget>[
|
||||
wrap('Ctrl ', () {
|
||||
setState(() => inputModel.ctrl = !inputModel.ctrl);
|
||||
@ -995,7 +995,7 @@ void showOptions(
|
||||
}
|
||||
more.add(getToggle(
|
||||
id, setState, 'lock-after-session-end', 'Lock after session end'));
|
||||
if (pi.platform == 'Windows') {
|
||||
if (pi.platform == kPeerPlatformWindows) {
|
||||
more.add(getToggle(id, setState, 'privacy-mode', 'Privacy mode'));
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
@ -347,7 +348,7 @@ class FileModel extends ChangeNotifier {
|
||||
id: parent.target?.id ?? "", name: "remote_show_hidden"))
|
||||
.isNotEmpty;
|
||||
_remoteOption.isWindows =
|
||||
parent.target?.ffiModel.pi.platform.toLowerCase() == "windows";
|
||||
parent.target?.ffiModel.pi.platform == kPeerPlatformWindows;
|
||||
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
|
||||
|
@ -61,7 +61,7 @@ class FfiModel with ChangeNotifier {
|
||||
|
||||
bool get touchMode => _touchMode;
|
||||
|
||||
bool get isPeerAndroid => _pi.platform == 'Android';
|
||||
bool get isPeerAndroid => _pi.platform == kPeerPlatformAndroid;
|
||||
|
||||
set inputBlocked(v) {
|
||||
_inputBlocked = v;
|
||||
@ -238,6 +238,11 @@ class FfiModel with ChangeNotifier {
|
||||
if ((_display.width > _display.height) != oldOrientation) {
|
||||
gFFI.canvasModel.updateViewStyle();
|
||||
}
|
||||
if (_pi.platform == kPeerPlatformLinux ||
|
||||
_pi.platform == kPeerPlatformWindows ||
|
||||
_pi.platform == kPeerPlatformMacOS) {
|
||||
parent.target?.canvasModel.updateViewStyle();
|
||||
}
|
||||
parent.target?.recordingModel.onSwitchDisplay();
|
||||
notifyListeners();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user