Merge pull request #6165 from sahilyeole/feat/list_view

Feat single peer per row/list view
This commit is contained in:
RustDesk 2023-10-26 11:59:59 +08:00 committed by GitHub
commit 39e6fa35e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 235 additions and 26 deletions

View File

@ -19,7 +19,7 @@ import 'dart:math' as math;
typedef PopupMenuEntryBuilder = Future<List<mod_menu.PopupMenuEntry<String>>>
Function(BuildContext);
enum PeerUiType { grid, list }
enum PeerUiType { grid, tile, list }
final peerCardUiType = PeerUiType.grid.obs;

View File

@ -215,29 +215,7 @@ class _PeerTabPageState extends State<PeerTabPage>
}
Widget _createPeerViewTypeSwitch(BuildContext context) {
final textColor = Theme.of(context).textTheme.titleLarge?.color;
final types = [PeerUiType.grid, PeerUiType.list];
return Obx(() => _hoverAction(
context: context,
onTap: () async {
final type = types
.elementAt(peerCardUiType.value == types.elementAt(0) ? 1 : 0);
await bind.setLocalFlutterOption(
k: 'peer-card-ui-type', v: type.index.toString());
peerCardUiType.value = type;
},
child: Tooltip(
message: peerCardUiType.value == PeerUiType.grid
? translate('List View')
: translate('Grid View'),
child: Icon(
peerCardUiType.value == PeerUiType.grid
? Icons.view_list_rounded
: Icons.grid_view_rounded,
size: 18,
color: textColor,
))));
return PeerViewDropdown();
}
Widget _createMultiSelection() {
@ -777,6 +755,85 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
}
}
class PeerViewDropdown extends StatefulWidget {
const PeerViewDropdown({super.key});
@override
State<PeerViewDropdown> createState() => _PeerViewDropdownState();
}
class _PeerViewDropdownState extends State<PeerViewDropdown> {
RelativeRect menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
@override
Widget build(BuildContext context) {
final List<PeerUiType> types = [PeerUiType.grid, PeerUiType.tile, PeerUiType.list];
final style = TextStyle(
color: Theme.of(context).textTheme.titleLarge?.color,
fontSize: MenuConfig.fontSize,
fontWeight: FontWeight.normal);
List<PopupMenuEntry> items = List.empty(growable: true);
items.add(PopupMenuItem(
height: 36,
enabled: false,
child: Text(translate("Change View"), style: style)));
for (var e in PeerUiType.values) {
items.add(PopupMenuItem(
height: 36,
child: Obx(() => Center(
child: SizedBox(
height: 36,
child: getRadio<PeerUiType>(
Text(translate(
types.indexOf(e) == 0 ? 'Big Tiles' : types.indexOf(e) == 1 ? 'Small Tiles' : 'List'
), style: style),
e,
peerCardUiType.value,
dense: true,
(PeerUiType? v) async {
if (v != null) {
peerCardUiType.value = v;
setState(() {});
await bind.setLocalFlutterOption(
k: "peer-card-ui-type",
v: peerCardUiType.value.index.toString(),
);
}}
),
),
))));
}
return _hoverAction(
context: context,
child: Tooltip(
message: translate('Change View'),
child: Icon(
peerCardUiType.value == PeerUiType.grid
? Icons.grid_view_rounded
: peerCardUiType.value == PeerUiType.tile
? Icons.view_list_rounded
: Icons.view_agenda_rounded,
size: 18,
)),
onTapDown: (details) {
final x = details.globalPosition.dx;
final y = details.globalPosition.dy;
setState(() {
menuPos = RelativeRect.fromLTRB(x, y, x, y);
});
},
onTap: () => showMenu(
context: context,
position: menuPos,
items: items,
elevation: 8,
),
);
}
}
class PeerSortDropdown extends StatefulWidget {
const PeerSortDropdown({super.key});

View File

@ -9,6 +9,7 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:visibility_detector/visibility_detector.dart';
import 'package:window_manager/window_manager.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart';
import '../../common.dart';
import '../../models/peer_model.dart';
@ -188,12 +189,19 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
onVisibilityChanged: onVisibilityChanged,
child: widget.peerCardBuilder(peer),
);
final windowWidth = MediaQuery.of(context).size.width;
final model = Provider.of<PeerTabModel>(context);
final hideAbTagsPanel = bind.mainGetLocalOption(key: "hideAbTagsPanel").isNotEmpty;
return isDesktop
? Obx(
() => SizedBox(
width: 220,
width: peerCardUiType.value != PeerUiType.list
? 220
: model.currentTab == PeerTabIndex.group.index || (model.currentTab == PeerTabIndex.ab.index && !hideAbTagsPanel)
? windowWidth - 390 :
windowWidth - 227,
height:
peerCardUiType.value == PeerUiType.grid ? 140 : 42,
peerCardUiType.value == PeerUiType.grid ? 140 : peerCardUiType.value != PeerUiType.list ? 42 : 45,
child: visibilityChild,
),
)

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "在单个窗口中打开显示器"),
("Use all my displays for the remote session", "将我的所有显示器用于远程会话"),
("selinux_tip", "SELinux 处于启用状态RustDesk 可能无法作为被控正常运行。"),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Zobrazit obrazovky jako jednotlivá okna"),
("Use all my displays for the remote session", "Použít všechny mé obrazovky pro vzdálenou relaci"),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Jeden Bildschirm in einem eigenen Fenster anzeigen"),
("Use all my displays for the remote session", "Alle meine Bildschirme für die Fernsitzung verwenden"),
("selinux_tip", "SELinux ist auf Ihrem Gerät aktiviert, was dazu führen kann, dass RustDesk als kontrollierte Seite nicht richtig läuft."),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Mostrar pantallas como ventanas individuales"),
("Use all my displays for the remote session", "Usar todas mis pantallas para la sesión remota"),
("selinux_tip", "SELinux está activado en tu dispositivo, lo que puede hacer que RustDesk no se ejecute correctamente como lado controlado."),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Tampilkan dengan jendela terpisah"),
("Use all my displays for the remote session", "Gunakan semua layar untuk sesi remote"),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -567,5 +567,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Use all my displays for the remote session", "Usa tutti gli schermi per la sessione remota"),
("selinux_tip", ""),
("selinux_tip", "In questo dispositivo è abilitato SELinux, che potrebbe impedire il corretto funzionamento di RustDesk come lato controllato."),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Rādīt displejus kā atsevišķus logus"),
("Use all my displays for the remote session", "Izmantot visus manus displejus attālajai sesijai"),
("selinux_tip", "Jūsu ierīcē ir iespējots SELinux, kas var neļaut RustDesk pareizi darboties kā kontrolētajai pusei."),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Beeldschermen weergeven als afzonderlijke vensters"),
("Use all my displays for the remote session", "Gebruik al mijn beeldschermen voor de externe sessie"),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Pokaż ekrany w osobnych oknach"),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Показывать дисплеи в отдельных окнах"),
("Use all my displays for the remote session", "Использовать все мои дисплеи для удалённого сеанса"),
("selinux_tip", "На вашем устройстве включён SELinux, что может помешать правильной работе RustDesk на контролируемой стороне."),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", "Відображати дисплеї в якості окремих вікон"),
("Use all my displays for the remote session", "Використовувати всі мої дисплеї для віддаленого сеансу"),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}

View File

@ -566,5 +566,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Show displays as individual windows", ""),
("Use all my displays for the remote session", ""),
("selinux_tip", ""),
("Change View", ""),
("Big Tiles", ""),
("Small Tiles", ""),
("List", ""),
].iter().cloned().collect();
}