From 656a7c6e26fe102f95407d40bd12fda1d040e8ac Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Fri, 3 Mar 2023 20:53:42 +0100 Subject: [PATCH 1/9] implemented sorting in every tab except "recent sessions" --- flutter/lib/common/widgets/peer_tab_page.dart | 86 +++++++++++++++---- flutter/lib/common/widgets/peers_view.dart | 41 ++++++++- 2 files changed, 107 insertions(+), 20 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index da7e37e6b..d0ab51058 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -12,6 +12,7 @@ import 'package:flutter_hbb/desktop/widgets/popup_menu.dart'; import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart'; import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart' as mod_menu; +import 'package:flutter_hbb/models/file_model.dart'; import 'package:flutter_hbb/models/peer_tab_model.dart'; import 'package:get/get.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; @@ -39,6 +40,8 @@ EdgeInsets? _menuPadding() { class _PeerTabPageState extends State with SingleTickerProviderStateMixin { + bool _hideSort = bind.getLocalFlutterConfig(k: 'peer-tab-index') == '0'; + final List<_TabEntry> entries = [ _TabEntry( RecentPeersView( @@ -83,6 +86,7 @@ class _PeerTabPageState extends State if (tabIndex < entries.length) { gFFI.peerTabModel.setCurrentTab(tabIndex); entries[tabIndex].load(); + _hideSort = tabIndex == 0; } } @@ -95,22 +99,27 @@ class _PeerTabPageState extends State SizedBox( height: 28, child: Container( - padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2), - constraints: isDesktop ? null : kMobilePageConstraints, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: visibleContextMenuListener( - _createSwitchBar(context))), - buildScrollJumper(), - const PeerSearchBar(), - Offstage( - offstage: !isDesktop, - child: _createPeerViewTypeSwitch(context) - .marginOnly(left: 13)), - ], - )), + padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2), + constraints: isDesktop ? null : kMobilePageConstraints, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: + visibleContextMenuListener(_createSwitchBar(context))), + buildScrollJumper(), + const PeerSearchBar(), + Offstage( + offstage: !isDesktop, + child: _createPeerViewTypeSwitch(context) + .marginOnly(left: 13)), + Offstage( + offstage: _hideSort, + child: PeerSortDropdown(), + ) + ], + ), + ), ), _createPeersView(), ], @@ -417,3 +426,48 @@ class _PeerSearchBarState extends State { ); } } + +class PeerSortDropdown extends StatefulWidget { + const PeerSortDropdown({super.key}); + + @override + State createState() => _PeerSortDropdownState(); +} + +class _PeerSortDropdownState extends State { + final List sort_names = ['id', 'username', "status"]; + String _sortType = peerSort.value; + + @override + Widget build(BuildContext context) { + return DropdownButton( + value: _sortType, + elevation: 16, + underline: SizedBox(), + onChanged: (v) { + if (v != null) { + setState(() { + _sortType = v; + bind.setLocalFlutterConfig( + k: "peer-sorting", + v: _sortType, + ); + }); + peerSort.value = _sortType; + } + }, + dropdownColor: Theme.of(context).cardColor, + items: sort_names + .map>( + (String value) => DropdownMenuItem( + value: value, + child: Text( + value, + overflow: TextOverflow.ellipsis, + ), + ), + ) + .toList(), + ); + } +} diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 9c98f24b8..88e05238e 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -18,6 +18,13 @@ typedef PeerCardBuilder = Widget Function(Peer peer); /// for peer search text, global obs value final peerSearchText = "".obs; + +/// for peer sort, global obs value +final peerSort = bind.getLocalFlutterConfig(k: 'peer-sorting').obs; + +// list for listener +final obslist = [peerSearchText, peerSort].obs; + final peerSearchTextController = TextEditingController(text: peerSearchText.value); @@ -101,7 +108,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { } Widget _buildPeersView(Peers peers) { - final body = ObxValue((searchText) { + final body = ObxValue((filters) { return FutureBuilder>( builder: (context, snapshot) { if (snapshot.hasData) { @@ -139,9 +146,9 @@ class _PeersViewState extends State<_PeersView> with WindowListener { ); } }, - future: matchPeers(searchText.value, peers.peers), + future: matchPeers(filters[0].value, filters[1].value, peers.peers), ); - }, peerSearchText); + }, obslist); return body; } @@ -179,11 +186,36 @@ class _PeersViewState extends State<_PeersView> with WindowListener { }(); } - Future>? matchPeers(String searchText, List peers) async { + Future>? matchPeers( + String searchText, String sortedBy, List peers) async { if (widget.peerFilter != null) { peers = peers.where((peer) => widget.peerFilter!(peer)).toList(); } + // fallback to id sorting + if (sortedBy.isEmpty) { + sortedBy = 'id'; + bind.setLocalFlutterConfig( + k: "peer-sorting", + v: sortedBy, + ); + } + + if (widget.peers.loadEvent != 'load_recent_peers') { + switch (sortedBy) { + case 'id': + peers.sort((p1, p2) => p1.id.compareTo(p2.id)); + break; + case 'username': + peers.sort((p1, p2) => + p1.username.toLowerCase().compareTo(p2.username.toLowerCase())); + break; + case 'status': + peers.sort((p1, p2) => p1.online ? 1 : -1); + break; + } + } + searchText = searchText.trim(); if (searchText.isEmpty) { return peers; @@ -197,6 +229,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { filteredList.add(peers[i]); } } + return filteredList; } } From a04351baf4e8ea7cd3f38ea98228ce3578079034 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Fri, 3 Mar 2023 20:53:42 +0100 Subject: [PATCH 2/9] implemented sorting in every tab except "recent sessions" --- flutter/lib/common/widgets/peer_tab_page.dart | 86 +++++++++++++++---- flutter/lib/common/widgets/peers_view.dart | 41 ++++++++- 2 files changed, 107 insertions(+), 20 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index da7e37e6b..d0ab51058 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -12,6 +12,7 @@ import 'package:flutter_hbb/desktop/widgets/popup_menu.dart'; import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart'; import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart' as mod_menu; +import 'package:flutter_hbb/models/file_model.dart'; import 'package:flutter_hbb/models/peer_tab_model.dart'; import 'package:get/get.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; @@ -39,6 +40,8 @@ EdgeInsets? _menuPadding() { class _PeerTabPageState extends State with SingleTickerProviderStateMixin { + bool _hideSort = bind.getLocalFlutterConfig(k: 'peer-tab-index') == '0'; + final List<_TabEntry> entries = [ _TabEntry( RecentPeersView( @@ -83,6 +86,7 @@ class _PeerTabPageState extends State if (tabIndex < entries.length) { gFFI.peerTabModel.setCurrentTab(tabIndex); entries[tabIndex].load(); + _hideSort = tabIndex == 0; } } @@ -95,22 +99,27 @@ class _PeerTabPageState extends State SizedBox( height: 28, child: Container( - padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2), - constraints: isDesktop ? null : kMobilePageConstraints, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: visibleContextMenuListener( - _createSwitchBar(context))), - buildScrollJumper(), - const PeerSearchBar(), - Offstage( - offstage: !isDesktop, - child: _createPeerViewTypeSwitch(context) - .marginOnly(left: 13)), - ], - )), + padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2), + constraints: isDesktop ? null : kMobilePageConstraints, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: + visibleContextMenuListener(_createSwitchBar(context))), + buildScrollJumper(), + const PeerSearchBar(), + Offstage( + offstage: !isDesktop, + child: _createPeerViewTypeSwitch(context) + .marginOnly(left: 13)), + Offstage( + offstage: _hideSort, + child: PeerSortDropdown(), + ) + ], + ), + ), ), _createPeersView(), ], @@ -417,3 +426,48 @@ class _PeerSearchBarState extends State { ); } } + +class PeerSortDropdown extends StatefulWidget { + const PeerSortDropdown({super.key}); + + @override + State createState() => _PeerSortDropdownState(); +} + +class _PeerSortDropdownState extends State { + final List sort_names = ['id', 'username', "status"]; + String _sortType = peerSort.value; + + @override + Widget build(BuildContext context) { + return DropdownButton( + value: _sortType, + elevation: 16, + underline: SizedBox(), + onChanged: (v) { + if (v != null) { + setState(() { + _sortType = v; + bind.setLocalFlutterConfig( + k: "peer-sorting", + v: _sortType, + ); + }); + peerSort.value = _sortType; + } + }, + dropdownColor: Theme.of(context).cardColor, + items: sort_names + .map>( + (String value) => DropdownMenuItem( + value: value, + child: Text( + value, + overflow: TextOverflow.ellipsis, + ), + ), + ) + .toList(), + ); + } +} diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 9c98f24b8..88e05238e 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -18,6 +18,13 @@ typedef PeerCardBuilder = Widget Function(Peer peer); /// for peer search text, global obs value final peerSearchText = "".obs; + +/// for peer sort, global obs value +final peerSort = bind.getLocalFlutterConfig(k: 'peer-sorting').obs; + +// list for listener +final obslist = [peerSearchText, peerSort].obs; + final peerSearchTextController = TextEditingController(text: peerSearchText.value); @@ -101,7 +108,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { } Widget _buildPeersView(Peers peers) { - final body = ObxValue((searchText) { + final body = ObxValue((filters) { return FutureBuilder>( builder: (context, snapshot) { if (snapshot.hasData) { @@ -139,9 +146,9 @@ class _PeersViewState extends State<_PeersView> with WindowListener { ); } }, - future: matchPeers(searchText.value, peers.peers), + future: matchPeers(filters[0].value, filters[1].value, peers.peers), ); - }, peerSearchText); + }, obslist); return body; } @@ -179,11 +186,36 @@ class _PeersViewState extends State<_PeersView> with WindowListener { }(); } - Future>? matchPeers(String searchText, List peers) async { + Future>? matchPeers( + String searchText, String sortedBy, List peers) async { if (widget.peerFilter != null) { peers = peers.where((peer) => widget.peerFilter!(peer)).toList(); } + // fallback to id sorting + if (sortedBy.isEmpty) { + sortedBy = 'id'; + bind.setLocalFlutterConfig( + k: "peer-sorting", + v: sortedBy, + ); + } + + if (widget.peers.loadEvent != 'load_recent_peers') { + switch (sortedBy) { + case 'id': + peers.sort((p1, p2) => p1.id.compareTo(p2.id)); + break; + case 'username': + peers.sort((p1, p2) => + p1.username.toLowerCase().compareTo(p2.username.toLowerCase())); + break; + case 'status': + peers.sort((p1, p2) => p1.online ? 1 : -1); + break; + } + } + searchText = searchText.trim(); if (searchText.isEmpty) { return peers; @@ -197,6 +229,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { filteredList.add(peers[i]); } } + return filteredList; } } From a4ef60a250bf5cc40f4d949e72160fbdc2867d5a Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Tue, 7 Mar 2023 19:27:39 +0100 Subject: [PATCH 3/9] reduced peer view type to one toggle, moved sorting button under peer view type --- flutter/lib/common/widgets/peer_tab_page.dart | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index d0ab51058..b0ad4138a 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -113,14 +113,19 @@ class _PeerTabPageState extends State offstage: !isDesktop, child: _createPeerViewTypeSwitch(context) .marginOnly(left: 13)), - Offstage( - offstage: _hideSort, - child: PeerSortDropdown(), - ) ], ), ), ), + Row( + children: [ + Expanded(child: SizedBox()), + Offstage( + offstage: _hideSort, + child: PeerSortDropdown(), + ), + ], + ), _createPeersView(), ], ); @@ -240,32 +245,32 @@ class _PeerTabPageState extends State Widget _createPeerViewTypeSwitch(BuildContext context) { final textColor = Theme.of(context).textTheme.titleLarge?.color; - final activeDeco = - BoxDecoration(color: Theme.of(context).colorScheme.background); - return Row( - children: [PeerUiType.grid, PeerUiType.list] - .map((type) => Obx( - () => Container( - padding: EdgeInsets.all(4.0), - decoration: peerCardUiType.value == type ? activeDeco : null, - child: InkWell( - onTap: () async { - await bind.setLocalFlutterConfig( - k: 'peer-card-ui-type', v: type.index.toString()); - peerCardUiType.value = type; - }, - child: Icon( - type == PeerUiType.grid - ? Icons.grid_view_rounded - : Icons.list, - size: 18, - color: - peerCardUiType.value == type ? textColor : textColor - ?..withOpacity(0.5), - )), - ), - )) - .toList(), + final activeDeco = BoxDecoration( + color: Theme.of(context).colorScheme.background, + borderRadius: BorderRadius.circular(5), + ); + final types = [PeerUiType.grid, PeerUiType.list]; + + return Obx( + () => Container( + padding: EdgeInsets.all(4.0), + decoration: activeDeco, + child: InkWell( + onTap: () async { + final type = types.elementAt( + peerCardUiType.value == types.elementAt(0) ? 1 : 0); + await bind.setLocalFlutterConfig( + k: 'peer-card-ui-type', v: type.index.toString()); + peerCardUiType.value = type; + }, + child: Icon( + peerCardUiType.value == PeerUiType.grid + ? Icons.list_rounded + : Icons.grid_view_rounded, + size: 18, + color: textColor, + )), + ), ); } @@ -441,7 +446,7 @@ class _PeerSortDropdownState extends State { @override Widget build(BuildContext context) { return DropdownButton( - value: _sortType, + value: _sortType == "" ? 'id' : _sortType, elevation: 16, underline: SizedBox(), onChanged: (v) { From 43da91863045d0c6dcbab119827942e0c8b56723 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Tue, 7 Mar 2023 20:31:20 +0100 Subject: [PATCH 4/9] rounded tiles --- flutter/lib/common/widgets/peer_card.dart | 45 ++++++++++++------- flutter/lib/common/widgets/peer_tab_page.dart | 3 +- flutter/lib/common/widgets/peers_view.dart | 2 +- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/flutter/lib/common/widgets/peer_card.dart b/flutter/lib/common/widgets/peer_card.dart index 7d2d0cd2d..536d5e0c2 100644 --- a/flutter/lib/common/widgets/peer_card.dart +++ b/flutter/lib/common/widgets/peer_card.dart @@ -42,6 +42,7 @@ class _PeerCardState extends State<_PeerCard> with AutomaticKeepAliveClientMixin { var _menuPos = RelativeRect.fill; final double _cardRadius = 16; + final double _tileRadius = 5; final double _borderWidth = 2; @override @@ -116,27 +117,32 @@ class _PeerCardState extends State<_PeerCard> Widget _buildDesktop() { final peer = super.widget.peer; - var deco = Rx(BoxDecoration( + var deco = Rx( + BoxDecoration( border: Border.all(color: Colors.transparent, width: _borderWidth), - borderRadius: peerCardUiType.value == PeerUiType.grid - ? BorderRadius.circular(_cardRadius) - : null)); + borderRadius: BorderRadius.circular( + peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius, + ), + ), + ); return MouseRegion( onEnter: (evt) { deco.value = BoxDecoration( - border: Border.all( - color: Theme.of(context).colorScheme.primary, - width: _borderWidth), - borderRadius: peerCardUiType.value == PeerUiType.grid - ? BorderRadius.circular(_cardRadius) - : null); + border: Border.all( + color: Theme.of(context).colorScheme.primary, + width: _borderWidth), + borderRadius: BorderRadius.circular( + peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius, + ), + ); }, onExit: (evt) { deco.value = BoxDecoration( - border: Border.all(color: Colors.transparent, width: _borderWidth), - borderRadius: peerCardUiType.value == PeerUiType.grid - ? BorderRadius.circular(_cardRadius) - : null); + border: Border.all(color: Colors.transparent, width: _borderWidth), + borderRadius: BorderRadius.circular( + peerCardUiType.value == PeerUiType.grid ? _cardRadius : _tileRadius, + ), + ); }, child: GestureDetector( onDoubleTap: () => widget.connect(context, peer.id), @@ -163,6 +169,10 @@ class _PeerCardState extends State<_PeerCard> Container( decoration: BoxDecoration( color: str2color('${peer.id}${peer.platform}', 0x7f), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(_tileRadius), + bottomLeft: Radius.circular(_tileRadius), + ), ), alignment: Alignment.center, width: 42, @@ -171,7 +181,12 @@ class _PeerCardState extends State<_PeerCard> Expanded( child: Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.background), + color: Theme.of(context).colorScheme.background, + borderRadius: BorderRadius.only( + topRight: Radius.circular(_tileRadius), + bottomRight: Radius.circular(_tileRadius), + ), + ), child: Row( children: [ Expanded( diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index b0ad4138a..cbc3b1370 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -12,7 +12,6 @@ import 'package:flutter_hbb/desktop/widgets/popup_menu.dart'; import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart'; import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart' as mod_menu; -import 'package:flutter_hbb/models/file_model.dart'; import 'package:flutter_hbb/models/peer_tab_model.dart'; import 'package:get/get.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; @@ -446,7 +445,7 @@ class _PeerSortDropdownState extends State { @override Widget build(BuildContext context) { return DropdownButton( - value: _sortType == "" ? 'id' : _sortType, + value: _sortType.isEmpty ? 'id' : _sortType, elevation: 16, underline: SizedBox(), onChanged: (v) { diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 88e05238e..2bc0f6fbb 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -211,7 +211,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { p1.username.toLowerCase().compareTo(p2.username.toLowerCase())); break; case 'status': - peers.sort((p1, p2) => p1.online ? 1 : -1); + peers.sort((p1, p2) => p1.online ? -1 : 1); break; } } From 8cb0cc0a5df641e156067ecbe303aad06482b6c2 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Wed, 8 Mar 2023 16:35:33 +0100 Subject: [PATCH 5/9] added "Sort by" translations --- src/lang/ca.rs | 1 + src/lang/cn.rs | 1 + src/lang/cs.rs | 1 + src/lang/da.rs | 1 + src/lang/de.rs | 1 + src/lang/eo.rs | 1 + src/lang/es.rs | 1 + src/lang/fa.rs | 1 + src/lang/fr.rs | 1 + src/lang/gr.rs | 1 + src/lang/hu.rs | 1 + src/lang/id.rs | 1 + src/lang/it.rs | 5 +++-- src/lang/ja.rs | 1 + src/lang/ko.rs | 1 + src/lang/kz.rs | 1 + src/lang/nl.rs | 1 + src/lang/pl.rs | 1 + src/lang/pt_PT.rs | 1 + src/lang/ptbr.rs | 1 + src/lang/ro.rs | 1 + src/lang/ru.rs | 1 + src/lang/sk.rs | 1 + src/lang/sl.rs | 1 + src/lang/sq.rs | 1 + src/lang/sr.rs | 1 + src/lang/sv.rs | 1 + src/lang/template.rs | 1 + src/lang/th.rs | 1 + src/lang/tr.rs | 1 + src/lang/tw.rs | 1 + src/lang/ua.rs | 1 + src/lang/vn.rs | 1 + 33 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/lang/ca.rs b/src/lang/ca.rs index c4bc10bb4..9cb09cef7 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 163c50e1b..408013eae 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "分辨率"), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index e3ddc5db8..ddc29cbc2 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index f37f30a61..be49f5c21 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 7a935d299..35c1b58da 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Auflösung"), ("No transfers in progress", "Keine Übertragungen im Gange"), ("Set one-time password length", "Länge des Einmalpassworts festlegen"), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index ed64addf8..02b65adcb 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 3270ae26c..a8b616994 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Resolución"), ("No transfers in progress", "No hay transferencias en curso"), ("Set one-time password length", "Establecer contraseña de un solo uso"), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index e2a7e9516..741149b97 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "وضوح"), ("No transfers in progress", "هیچ انتقالی در حال انجام نیست"), ("Set one-time password length", "طول رمز یکبار مصرف را تعیین کنید"), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index c0d739f91..be39c42d2 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/gr.rs b/src/lang/gr.rs index 819c257c3..139315099 100644 --- a/src/lang/gr.rs +++ b/src/lang/gr.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Ανάλυση"), ("No transfers in progress", "Δεν υπάρχει μεταφορά σε εξέλιξη"), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 46750eb13..192126892 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 4133f136f..ed4167d9d 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 17f066eef..c4d2236c9 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -208,7 +208,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("x11 expected", "x11 necessario"), ("Port", "Porta"), ("Settings", "Impostazioni"), - ("Username", " Nome utente"), + ("Username", "Nome utente"), ("Invalid port", "Numero di porta non valido"), ("Closed manually by the peer", "Chiuso manualmente dal peer"), ("Enable remote configuration modification", "Abilita la modifica remota della configurazione"), @@ -460,6 +460,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Codec", "Codec"), ("Resolution", "Risoluzione"), ("No transfers in progress", "Nessun trasferimento in corso"), - ("Set one-time password length", ""), + ("Set one-time password length", "Imposta lunghezza password monouso"), + ("Sort by", "Ordina per"), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index b8031573a..6b98b4a17 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index fe6a0bfe9..237b27382 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 4b1e92cad..c0adba507 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index 7888eed8e..f749d45f6 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Resolutie"), ("No transfers in progress", "Geen overdrachten in uitvoering"), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index b997267f1..95f145a2e 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Rozdzielczość"), ("No transfers in progress", "Brak transferów w toku"), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 98b8035a4..7fff174fd 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 18c9168c1..1efcaf6c2 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 225fa7277..6ad0c2974 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 59957a2cd..1bb44608f 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Разрешение"), ("No transfers in progress", "Передача не осуществляется"), ("Set one-time password length", "Установить длину одноразового пароля"), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index cec9e5b3d..3c19b9cfc 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 295cd28a1..78e2e8504 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index ebbdf4a28..9aa5a38c8 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 67fb49799..fccb383a9 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 9da1f1071..ef93478ca 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index cbbd65b4c..005e1cf0d 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 97a8725e3..68dc955da 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 3b1137cb7..717c79bd4 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 72a38afcd..3bfcfaf2c 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "分辨率"), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 4665d7c39..fa8c40cb0 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 0130b11cf..33007597c 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -461,5 +461,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", ""), ("No transfers in progress", ""), ("Set one-time password length", ""), + ("Sort by", ""), ].iter().cloned().collect(); } From 2724c16e3422643d29518f7bc298aef99d6cdd28 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Wed, 8 Mar 2023 16:40:35 +0100 Subject: [PATCH 6/9] improved design and moved sort button --- flutter/lib/common/widgets/peer_tab_page.dart | 109 +++++++++++------- flutter/pubspec.lock | 8 ++ flutter/pubspec.yaml | 1 + 3 files changed, 79 insertions(+), 39 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index cbc3b1370..cdafbc4f1 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -17,6 +17,7 @@ import 'package:get/get.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; import 'package:provider/provider.dart'; import 'package:visibility_detector/visibility_detector.dart'; +import 'package:dropdown_button2/dropdown_button2.dart'; import '../../common.dart'; import '../../models/platform_model.dart'; @@ -112,19 +113,14 @@ class _PeerTabPageState extends State offstage: !isDesktop, child: _createPeerViewTypeSwitch(context) .marginOnly(left: 13)), + Offstage( + offstage: _hideSort, + child: PeerSortDropdown().marginOnly(left: 8), + ), ], ), ), ), - Row( - children: [ - Expanded(child: SizedBox()), - Offstage( - offstage: _hideSort, - child: PeerSortDropdown(), - ), - ], - ), _createPeersView(), ], ); @@ -244,7 +240,7 @@ class _PeerTabPageState extends State Widget _createPeerViewTypeSwitch(BuildContext context) { final textColor = Theme.of(context).textTheme.titleLarge?.color; - final activeDeco = BoxDecoration( + final deco = BoxDecoration( color: Theme.of(context).colorScheme.background, borderRadius: BorderRadius.circular(5), ); @@ -253,7 +249,7 @@ class _PeerTabPageState extends State return Obx( () => Container( padding: EdgeInsets.all(4.0), - decoration: activeDeco, + decoration: deco, child: InkWell( onTap: () async { final type = types.elementAt( @@ -439,39 +435,74 @@ class PeerSortDropdown extends StatefulWidget { } class _PeerSortDropdownState extends State { - final List sort_names = ['id', 'username', "status"]; + final List sort_names = ['Remote ID', 'Username', "Status"]; String _sortType = peerSort.value; @override Widget build(BuildContext context) { - return DropdownButton( - value: _sortType.isEmpty ? 'id' : _sortType, - elevation: 16, - underline: SizedBox(), - onChanged: (v) { - if (v != null) { - setState(() { - _sortType = v; - bind.setLocalFlutterConfig( - k: "peer-sorting", - v: _sortType, - ); - }); - peerSort.value = _sortType; - } - }, - dropdownColor: Theme.of(context).cardColor, - items: sort_names - .map>( - (String value) => DropdownMenuItem( - value: value, - child: Text( - value, - overflow: TextOverflow.ellipsis, - ), + final deco = BoxDecoration( + color: Theme.of(context).colorScheme.background, + borderRadius: BorderRadius.circular(5), + ); + return Container( + padding: EdgeInsets.all(4.0), + decoration: deco, + child: DropdownButtonHideUnderline( + child: DropdownButton2( + value: sort_names.contains(_sortType) ? _sortType : sort_names[0], + onChanged: (v) async { + if (v != null) { + setState(() => _sortType = v); + await bind.setLocalFlutterConfig( + k: "peer-sorting", + v: _sortType, + ); + peerSort.value = _sortType; + } + }, + customButton: Icon( + Icons.sort, + size: 18, ), - ) - .toList(), + dropdownStyleData: DropdownStyleData( + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(10), + ), + width: 160, + ), + items: [ + DropdownMenuItem( + alignment: Alignment.center, + child: Text( + translate("Sort by"), + style: TextStyle(fontWeight: FontWeight.bold), + ), + enabled: false, + ), + ...sort_names + .map>( + (String value) => DropdownMenuItem( + value: value, + child: Row( + children: [ + Icon( + value == _sortType + ? Icons.radio_button_checked_rounded + : Icons.radio_button_off_rounded, + size: 18, + ).paddingOnly(right: 12), + Text( + translate(value), + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ) + .toList(), + ]), + ), ); } } diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 63f6c804c..f3db95378 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -386,6 +386,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.2" + dropdown_button2: + dependency: "direct main" + description: + name: dropdown_button2 + sha256: "4458d81bfd24207f3d58f66f78097064e02f810f94cf1bc80bf20fe7685ebc80" + url: "https://pub.dev" + source: hosted + version: "2.0.0" event_bus: dependency: transitive description: diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index ccb53cc9c..a212a5093 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -94,6 +94,7 @@ dependencies: flutter_keyboard_visibility: ^5.4.0 texture_rgba_renderer: ^0.0.12 percent_indicator: ^4.2.2 + dropdown_button2: ^2.0.0 dev_dependencies: icons_launcher: ^2.0.4 From f042ed44bd17bb6bea0489a791c336a5bf0c2978 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Wed, 8 Mar 2023 20:10:08 +0100 Subject: [PATCH 7/9] refactor strings in a separate class, added alias and remote host sort types --- flutter/lib/common/widgets/peer_tab_page.dart | 7 ++-- flutter/lib/common/widgets/peers_view.dart | 34 ++++++++++++++++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index cdafbc4f1..e3bb3a5be 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -435,7 +435,6 @@ class PeerSortDropdown extends StatefulWidget { } class _PeerSortDropdownState extends State { - final List sort_names = ['Remote ID', 'Username', "Status"]; String _sortType = peerSort.value; @override @@ -449,7 +448,9 @@ class _PeerSortDropdownState extends State { decoration: deco, child: DropdownButtonHideUnderline( child: DropdownButton2( - value: sort_names.contains(_sortType) ? _sortType : sort_names[0], + value: PeerSortType.values.contains(_sortType) + ? _sortType + : PeerSortType.remoteId, onChanged: (v) async { if (v != null) { setState(() => _sortType = v); @@ -480,7 +481,7 @@ class _PeerSortDropdownState extends State { ), enabled: false, ), - ...sort_names + ...PeerSortType.values .map>( (String value) => DropdownMenuItem( value: value, diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 2bc0f6fbb..640f7d085 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -16,6 +16,22 @@ import 'peer_card.dart'; typedef PeerFilter = bool Function(Peer peer); typedef PeerCardBuilder = Widget Function(Peer peer); +class PeerSortType { + static const String remoteId = 'Remote ID'; + static const String remoteHost = 'Remote Host'; + static const String alias = 'Alias'; + static const String username = 'Username'; + static const String status = 'Status'; + + static List values = [ + PeerSortType.remoteId, + PeerSortType.remoteHost, + PeerSortType.alias, + PeerSortType.username, + PeerSortType.status + ]; +} + /// for peer search text, global obs value final peerSearchText = "".obs; @@ -193,8 +209,8 @@ class _PeersViewState extends State<_PeersView> with WindowListener { } // fallback to id sorting - if (sortedBy.isEmpty) { - sortedBy = 'id'; + if (!PeerSortType.values.contains(sortedBy)) { + sortedBy = PeerSortType.remoteId; bind.setLocalFlutterConfig( k: "peer-sorting", v: sortedBy, @@ -203,14 +219,22 @@ class _PeersViewState extends State<_PeersView> with WindowListener { if (widget.peers.loadEvent != 'load_recent_peers') { switch (sortedBy) { - case 'id': + case PeerSortType.remoteId: peers.sort((p1, p2) => p1.id.compareTo(p2.id)); break; - case 'username': + case PeerSortType.remoteHost: + peers.sort((p1, p2) => + p1.hostname.toLowerCase().compareTo(p2.hostname.toLowerCase())); + break; + case PeerSortType.alias: + peers.sort((p1, p2) => + p1.alias.toLowerCase().compareTo(p2.alias.toLowerCase())); + break; + case PeerSortType.username: peers.sort((p1, p2) => p1.username.toLowerCase().compareTo(p2.username.toLowerCase())); break; - case 'status': + case PeerSortType.status: peers.sort((p1, p2) => p1.online ? -1 : 1); break; } From c307013325fe9b074f40b8147467dc3ba413def3 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Wed, 8 Mar 2023 21:04:03 +0100 Subject: [PATCH 8/9] fix bug fallback peer sort setting --- flutter/lib/common/widgets/peer_tab_page.dart | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index e3bb3a5be..869bd5fd9 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -435,7 +435,17 @@ class PeerSortDropdown extends StatefulWidget { } class _PeerSortDropdownState extends State { - String _sortType = peerSort.value; + @override + void initState() { + if (!PeerSortType.values.contains(peerSort.value)) { + peerSort.value = PeerSortType.remoteId; + bind.setLocalFlutterConfig( + k: "peer-sorting", + v: peerSort.value, + ); + } + super.initState(); + } @override Widget build(BuildContext context) { @@ -448,17 +458,13 @@ class _PeerSortDropdownState extends State { decoration: deco, child: DropdownButtonHideUnderline( child: DropdownButton2( - value: PeerSortType.values.contains(_sortType) - ? _sortType - : PeerSortType.remoteId, onChanged: (v) async { if (v != null) { - setState(() => _sortType = v); + setState(() => peerSort.value = v); await bind.setLocalFlutterConfig( k: "peer-sorting", - v: _sortType, + v: peerSort.value, ); - peerSort.value = _sortType; } }, customButton: Icon( @@ -488,7 +494,7 @@ class _PeerSortDropdownState extends State { child: Row( children: [ Icon( - value == _sortType + value == peerSort.value ? Icons.radio_button_checked_rounded : Icons.radio_button_off_rounded, size: 18, From 0b254aae045321570b75abcb8e12d5f2c66d55a1 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Wed, 8 Mar 2023 21:45:43 +0100 Subject: [PATCH 9/9] translations --- src/lang/it.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lang/it.rs b/src/lang/it.rs index 2ada1e208..4d2da35fa 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -461,9 +461,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Resolution", "Risoluzione"), ("No transfers in progress", "Nessun trasferimento in corso"), ("Set one-time password length", "Imposta la lunghezza della password monouso"), - ("idd_driver_tip", ""), - ("confirm_idd_driver_tip", ""), - ("RDP Settings", "Imposta lunghezza password monouso"), + ("idd_driver_tip", "Installa il driver per lo schermo virtuale che sarà utilizzato quando non si dispone di schermi fisici."), + ("confirm_idd_driver_tip", "L'opzione per installare il driver per lo schermo virtuale è selezionata. Nota che un certificato di test sarà installato per l'attendibilità del driver dello schermo virtuale. Questo certificato di test verrà utilizzato solo per l'attendibilità dei driver di RustDesk."), + ("RDP Settings", "Impostazioni RDP"), ("Sort by", "Ordina per"), ].iter().cloned().collect(); }