From d9e1b2df7fb80559a7e5b47b2410ba6e355c984c Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Tue, 24 Oct 2023 22:33:51 +0530 Subject: [PATCH] update peer view type options Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/peer_tab_page.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index b5143eb82..63d9e18f8 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -216,21 +216,24 @@ class _PeerTabPageState extends State Widget _createPeerViewTypeSwitch(BuildContext context) { final textColor = Theme.of(context).textTheme.titleLarge?.color; - final types = [PeerUiType.grid, PeerUiType.list]; + final types = [PeerUiType.grid, PeerUiType.tile, PeerUiType.list]; return Obx(() => _hoverAction( context: context, onTap: () async { - final type = types - .elementAt(peerCardUiType.value == types.elementAt(0) ? 1 : 0); + final currentIndex = types.indexOf(peerCardUiType.value); + final newIndex = (currentIndex + 1) % types.length; // cycle through types + final type = types[newIndex]; 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'), + ? translate('Small tiles') + : peerCardUiType.value == PeerUiType.tile + ? translate('List') + : translate('Big tiles'), child: Icon( peerCardUiType.value == PeerUiType.grid ? Icons.view_list_rounded