Implemented new custom sort and separated the sorted view for each car

This commit is contained in:
Dennis Nemec
2026-01-27 00:21:23 +01:00
parent 08322e6847
commit 366a3560dc
11 changed files with 181 additions and 141 deletions

View File

@ -0,0 +1,22 @@
List<String> reorderList(List<String> old, int oldIndex, int newIndex) {
List<String> tmp = [...old];
int newIndexCalc = newIndex - 1;
if (newIndex < oldIndex) {
newIndexCalc = newIndex;
}
if (newIndex == old.length) {
newIndexCalc = old.length - 1;
}
if (newIndex == 0) {
newIndexCalc = 0;
}
String oldItem = tmp.removeAt(oldIndex);
tmp.insert(newIndexCalc, oldItem);
return tmp;
}