fix sort inconsistency

This commit is contained in:
NicKoehler 2023-04-17 13:53:55 +02:00
parent 87b4453870
commit 5645def1d2
No known key found for this signature in database
GPG Key ID: AC21B113496F7253

View File

@ -455,12 +455,12 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
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<PeerSortDropdown> {
),
enabled: false,
),
...translated_text
...translated_text.entries
.map<DropdownMenuItem<String>>(
(String value) => DropdownMenuItem<String>(
value: value,
(MapEntry entry) => DropdownMenuItem<String>(
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,
),
],