mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-07 18:02:48 +08:00
flutter_desktop: connection type icon, tested windows
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
01e96a1134
commit
f42c6ffeaf
@ -45,12 +45,17 @@ class ConnectionType {
|
||||
Rx<String> get secure => _secure;
|
||||
Rx<String> get direct => _direct;
|
||||
|
||||
static String get strSecure => 'secure';
|
||||
static String get strInsecure => 'insecure';
|
||||
static String get strDirect => '';
|
||||
static String get strIndirect => '_relay';
|
||||
|
||||
void setSecure(bool v) {
|
||||
_secure.value = v ? 'secure' : 'insecure';
|
||||
_secure.value = v ? strSecure : strInsecure;
|
||||
}
|
||||
|
||||
void setDirect(bool v) {
|
||||
_direct.value = v ? '' : '_relay';
|
||||
_direct.value = v ? strDirect : strIndirect;
|
||||
}
|
||||
|
||||
bool isValid() {
|
||||
@ -63,11 +68,20 @@ class ConnectionTypeState {
|
||||
static String tag(String id) => 'connection_type_$id';
|
||||
|
||||
static void init(String id) {
|
||||
final ConnectionType collectionType = ConnectionType();
|
||||
Get.put(collectionType, tag: tag(id));
|
||||
final key = tag(id);
|
||||
if (!Get.isRegistered(tag: key)) {
|
||||
final ConnectionType collectionType = ConnectionType();
|
||||
Get.put(collectionType, tag: key);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete(String id) {
|
||||
final key = tag(id);
|
||||
if (Get.isRegistered(tag: key)) {
|
||||
Get.delete(tag: key);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete(String id) => Get.delete(tag: tag(id));
|
||||
static ConnectionType find(String id) =>
|
||||
Get.find<ConnectionType>(tag: tag(id));
|
||||
}
|
||||
|
@ -28,15 +28,17 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
|
||||
_ConnectionTabPageState(Map<String, dynamic> params) {
|
||||
final RxBool fullscreen = Get.find(tag: 'fullscreen');
|
||||
if (params['id'] != null) {
|
||||
final peerId = params['id'];
|
||||
if (peerId != null) {
|
||||
ConnectionTypeState.init(peerId);
|
||||
tabController.add(TabInfo(
|
||||
key: params['id'],
|
||||
label: params['id'],
|
||||
key: peerId,
|
||||
label: peerId,
|
||||
selectedIcon: selectedIcon,
|
||||
unselectedIcon: unselectedIcon,
|
||||
page: Obx(() => RemotePage(
|
||||
key: ValueKey(params['id']),
|
||||
id: params['id'],
|
||||
key: ValueKey(peerId),
|
||||
id: peerId,
|
||||
tabBarHeight:
|
||||
fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight,
|
||||
))));
|
||||
@ -89,10 +91,10 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
child: Scaffold(
|
||||
backgroundColor: MyTheme.color(context).bg,
|
||||
body: Obx(() => DesktopTab(
|
||||
controller: tabController,
|
||||
theme: theme,
|
||||
isMainWindow: false,
|
||||
showTabBar: fullscreen.isFalse,
|
||||
controller: tabController,
|
||||
theme: theme,
|
||||
isMainWindow: false,
|
||||
showTabBar: fullscreen.isFalse,
|
||||
onClose: () {
|
||||
tabController.clear();
|
||||
},
|
||||
@ -104,36 +106,45 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
.setFullscreen(fullscreen.isTrue);
|
||||
return pageView;
|
||||
},
|
||||
tabBuilder: (key, icon, label, themeConf) {
|
||||
final connectionType = ConnectionTypeState.find(key);
|
||||
if (!connectionType.isValid()) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon,
|
||||
label,
|
||||
],
|
||||
);
|
||||
} else {
|
||||
final iconName =
|
||||
'${connectionType.secure.value}${connectionType.direct.value}';
|
||||
final connectionIcon = Image.asset(
|
||||
'assets/$iconName.png',
|
||||
width: themeConf.iconSize,
|
||||
height: themeConf.iconSize,
|
||||
color: theme.selectedtabIconColor,
|
||||
);
|
||||
//.paddingOnly(right: 5);
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon,
|
||||
connectionIcon,
|
||||
label,
|
||||
],
|
||||
);
|
||||
}
|
||||
}))),
|
||||
tabBuilder: (key, icon, label, themeConf) => Obx(() {
|
||||
final connectionType = ConnectionTypeState.find(key);
|
||||
if (!ConnectionTypeState.find(key).isValid()) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon,
|
||||
label,
|
||||
],
|
||||
);
|
||||
} else {
|
||||
final msgDirect = translate(
|
||||
connectionType.direct.value ==
|
||||
ConnectionType.strDirect
|
||||
? 'Direct Connection'
|
||||
: 'Relay Connection');
|
||||
final msgSecure = translate(
|
||||
connectionType.secure.value ==
|
||||
ConnectionType.strSecure
|
||||
? 'Secure Connection'
|
||||
: 'Insecure Connection');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon,
|
||||
Tooltip(
|
||||
message: '$msgDirect\n$msgSecure',
|
||||
child: Image.asset(
|
||||
'assets/${connectionType.secure.value}${connectionType.direct.value}.png',
|
||||
width: themeConf.iconSize,
|
||||
height: themeConf.iconSize,
|
||||
).paddingOnly(right: 5),
|
||||
),
|
||||
label,
|
||||
],
|
||||
);
|
||||
}
|
||||
}),
|
||||
))),
|
||||
),
|
||||
));
|
||||
}
|
||||
@ -142,6 +153,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
if (tabController.state.value.tabs.isEmpty) {
|
||||
WindowController.fromWindowId(windowId()).hide();
|
||||
}
|
||||
ConnectionTypeState.delete(id);
|
||||
}
|
||||
|
||||
int windowId() {
|
||||
|
@ -58,14 +58,12 @@ class _RemotePageState extends State<RemotePage>
|
||||
PrivacyModeState.init(id);
|
||||
BlockInputState.init(id);
|
||||
CurrentDisplayState.init(id);
|
||||
ConnectionTypeState.init(id);
|
||||
}
|
||||
|
||||
void _removeStates(String id) {
|
||||
PrivacyModeState.delete(id);
|
||||
BlockInputState.delete(id);
|
||||
CurrentDisplayState.delete(id);
|
||||
ConnectionTypeState.delete(id);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "滚屏方式"),
|
||||
("Show Menubar", "显示菜单栏"),
|
||||
("Hide Menubar", "隐藏菜单栏"),
|
||||
("Direct Connection", "直接连接"),
|
||||
("Relay Connection", "中继连接"),
|
||||
("Secure Connection", "安全连接"),
|
||||
("Insecure Connection", "非安全连接"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Štýl posúvania"),
|
||||
("Show Menubar", "Zobrazit panel nabídek"),
|
||||
("Hide Menubar", "skrýt panel nabídek"),
|
||||
("Direct Connection", "Přímé spojení"),
|
||||
("Relay Connection", "Připojení relé"),
|
||||
("Secure Connection", "Zabezpečené připojení"),
|
||||
("Insecure Connection", "Nezabezpečené připojení"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Rulstil"),
|
||||
("Show Menubar", "Vis menulinje"),
|
||||
("Hide Menubar", "skjul menulinjen"),
|
||||
("Direct Connection", "Direkte forbindelse"),
|
||||
("Relay Connection", "Relæforbindelse"),
|
||||
("Secure Connection", "Sikker forbindelse"),
|
||||
("Insecure Connection", "Usikker forbindelse"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Scroll-Stil"),
|
||||
("Show Menubar", "Menüleiste anzeigen"),
|
||||
("Hide Menubar", "Menüleiste ausblenden"),
|
||||
("Direct Connection", "Direkte Verbindung"),
|
||||
("Relay Connection", "Relaisverbindung"),
|
||||
("Secure Connection", "Sichere Verbindung"),
|
||||
("Insecure Connection", "Unsichere Verbindung"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Ruluma Stilo"),
|
||||
("Show Menubar", "Montru menubreton"),
|
||||
("Hide Menubar", "kaŝi menubreton"),
|
||||
("Direct Connection", "Rekta Konekto"),
|
||||
("Relay Connection", "Relajsa Konekto"),
|
||||
("Secure Connection", "Sekura Konekto"),
|
||||
("Insecure Connection", "Nesekura Konekto"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Estilo de desplazamiento"),
|
||||
("Show Menubar", "ajustes de pantalla"),
|
||||
("Hide Menubar", "ocultar barra de menú"),
|
||||
("Direct Connection", "Conexión directa"),
|
||||
("Relay Connection", "Conexión de relé"),
|
||||
("Secure Connection", "Conexión segura"),
|
||||
("Insecure Connection", "Conexión insegura"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Style de défilement"),
|
||||
("Show Menubar", "Afficher la barre de menus"),
|
||||
("Hide Menubar", "masquer la barre de menus"),
|
||||
("Direct Connection", "Connexion directe"),
|
||||
("Relay Connection", "Connexion relais"),
|
||||
("Secure Connection", "Connexion sécurisée"),
|
||||
("Insecure Connection", "Connexion non sécurisée"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Görgetési stílus"),
|
||||
("Show Menubar", "Menüsor megjelenítése"),
|
||||
("Hide Menubar", "menüsor elrejtése"),
|
||||
("Direct Connection", "Közvetlen kapcsolat"),
|
||||
("Relay Connection", "Relé csatlakozás"),
|
||||
("Secure Connection", "Biztonságos kapcsolat"),
|
||||
("Insecure Connection", "Nem biztonságos kapcsolat"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Gaya Gulir"),
|
||||
("Show Menubar", "Tampilkan bilah menu"),
|
||||
("Hide Menubar", "sembunyikan bilah menu"),
|
||||
("Direct Connection", "Koneksi langsung"),
|
||||
("Relay Connection", "Koneksi Relay"),
|
||||
("Secure Connection", "Koneksi aman"),
|
||||
("Insecure Connection", "Koneksi Tidak Aman"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -312,5 +312,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Stile di scorrimento"),
|
||||
("Show Menubar", "Mostra la barra dei menu"),
|
||||
("Hide Menubar", "nascondi la barra dei menu"),
|
||||
("Direct Connection", "Connessione diretta"),
|
||||
("Relay Connection", "Collegamento a relè"),
|
||||
("Secure Connection", "Connessione sicura"),
|
||||
("Insecure Connection", "Connessione insicura"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -310,5 +310,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "スクロール スタイル"),
|
||||
("Show Menubar", "メニューバーを表示"),
|
||||
("Hide Menubar", "メニューバーを隠す"),
|
||||
("Direct Connection", "直接接続"),
|
||||
("Relay Connection", "リレー接続"),
|
||||
("Secure Connection", "安全な接続"),
|
||||
("Insecure Connection", "安全でない接続"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -310,5 +310,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "스크롤 스타일"),
|
||||
("Show Menubar", "메뉴 표시줄 표시"),
|
||||
("Hide Menubar", "메뉴 표시줄 숨기기"),
|
||||
("Direct Connection", "직접 연결"),
|
||||
("Relay Connection", "릴레이 연결"),
|
||||
("Secure Connection", "보안 연결"),
|
||||
("Insecure Connection", "안전하지 않은 연결"),
|
||||
].iter().cloned().collect();
|
||||
}
|
@ -314,5 +314,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Styl przewijania"),
|
||||
("Show Menubar", "Pokaż pasek menu"),
|
||||
("Hide Menubar", "ukryj pasek menu"),
|
||||
("Direct Connection", "Bezpośrednie połączenie"),
|
||||
("Relay Connection", "Połączenie przekaźnika"),
|
||||
("Secure Connection", "Bezpieczne połączenie"),
|
||||
("Insecure Connection", "Niepewne połączenie"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -310,5 +310,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Estilo de rolagem"),
|
||||
("Show Menubar", "Mostrar barra de menus"),
|
||||
("Hide Menubar", "ocultar barra de menu"),
|
||||
("Direct Connection", "Conexão direta"),
|
||||
("Relay Connection", "Conexão de relé"),
|
||||
("Secure Connection", "Conexão segura"),
|
||||
("Insecure Connection", "Conexão insegura"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", ""),
|
||||
("Show Menubar", ""),
|
||||
("Hide Menubar", ""),
|
||||
("Direct Connection", ""),
|
||||
("Relay Connection", ""),
|
||||
("Secure Connection", ""),
|
||||
("Insecure Connection", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Стиль прокрутки"),
|
||||
("Show Menubar", "Показать строку меню"),
|
||||
("Hide Menubar", "скрыть строку меню"),
|
||||
("Direct Connection", "Прямая связь"),
|
||||
("Relay Connection", "Релейное соединение"),
|
||||
("Secure Connection", "Безопасное соединение"),
|
||||
("Insecure Connection", "Небезопасное соединение"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Štýl posúvania"),
|
||||
("Show Menubar", "Zobraziť panel s ponukami"),
|
||||
("Hide Menubar", "skryť panel s ponukami"),
|
||||
("Direct Connection", "Priame pripojenie"),
|
||||
("Relay Connection", "Reléové pripojenie"),
|
||||
("Secure Connection", "Zabezpečené pripojenie"),
|
||||
("Insecure Connection", "Nezabezpečené pripojenie"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", ""),
|
||||
("Show Menubar", ""),
|
||||
("Hide Menubar", ""),
|
||||
("Direct Connection", ""),
|
||||
("Relay Connection", ""),
|
||||
("Secure Connection", ""),
|
||||
("Insecure Connection", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Kaydırma Stili"),
|
||||
("Show Menubar", "Menü çubuğunu göster"),
|
||||
("Hide Menubar", "menü çubuğunu gizle"),
|
||||
("Direct Connection", "Doğrudan Bağlantı"),
|
||||
("Relay Connection", "Röle Bağlantısı"),
|
||||
("Secure Connection", "Güvenli bağlantı"),
|
||||
("Insecure Connection", "Güvenli Bağlantı"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "滾動樣式"),
|
||||
("Show Menubar", "顯示菜單欄"),
|
||||
("Hide Menubar", "隱藏菜單欄"),
|
||||
("Direct Connection", "直接連接"),
|
||||
("Relay Connection", "中繼連接"),
|
||||
("Secure Connection", "安全連接"),
|
||||
("Insecure Connection", "非安全連接"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -313,5 +313,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scroll Style", "Kiểu cuộn"),
|
||||
("Show Menubar", "Hiển thị thanh menu"),
|
||||
("Hide Menubar", "ẩn thanh menu"),
|
||||
("Direct Connection", "Kết nối trực tiếp"),
|
||||
("Relay Connection", "Kết nối chuyển tiếp"),
|
||||
("Secure Connection", "Kết nối an toàn"),
|
||||
("Insecure Connection", "Kết nối không an toàn"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user