From 5645def1d2bfc969d3cdcb0116efa890dbf8f18e Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Mon, 17 Apr 2023 13:53:55 +0200 Subject: [PATCH] fix sort inconsistency --- flutter/lib/common/widgets/peer_tab_page.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index 0c8ac9329..fa9ed29c0 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -455,12 +455,12 @@ class _PeerSortDropdownState extends State { borderRadius: BorderRadius.circular(5), ); - final translated_text = - PeerSortType.values.map((e) => translate(e)).toList(); + final translated_text = { + for (var e in PeerSortType.values) e: translate(e) + }; final double max_width = - 50 + translated_text.map((e) => e.length).reduce(max) * 10; - + 50 + translated_text.values.map((e) => e.length).reduce(max) * 10; return Container( padding: EdgeInsets.all(4.0), decoration: deco, @@ -496,20 +496,20 @@ class _PeerSortDropdownState extends State { ), enabled: false, ), - ...translated_text + ...translated_text.entries .map>( - (String value) => DropdownMenuItem( - value: value, + (MapEntry entry) => DropdownMenuItem( + value: entry.key, child: Row( children: [ Icon( - value == peerSort.value + entry.key == peerSort.value ? Icons.radio_button_checked_rounded : Icons.radio_button_off_rounded, size: 18, ).paddingOnly(right: 12), Text( - value, + entry.value, overflow: TextOverflow.ellipsis, ), ],