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), borderRadius: BorderRadius.circular(5),
); );
final translated_text = final translated_text = {
PeerSortType.values.map((e) => translate(e)).toList(); for (var e in PeerSortType.values) e: translate(e)
};
final double max_width = 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( return Container(
padding: EdgeInsets.all(4.0), padding: EdgeInsets.all(4.0),
decoration: deco, decoration: deco,
@ -496,20 +496,20 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
), ),
enabled: false, enabled: false,
), ),
...translated_text ...translated_text.entries
.map<DropdownMenuItem<String>>( .map<DropdownMenuItem<String>>(
(String value) => DropdownMenuItem<String>( (MapEntry entry) => DropdownMenuItem<String>(
value: value, value: entry.key,
child: Row( child: Row(
children: [ children: [
Icon( Icon(
value == peerSort.value entry.key == peerSort.value
? Icons.radio_button_checked_rounded ? Icons.radio_button_checked_rounded
: Icons.radio_button_off_rounded, : Icons.radio_button_off_rounded,
size: 18, size: 18,
).paddingOnly(right: 12), ).paddingOnly(right: 12),
Text( Text(
value, entry.value,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
], ],