fix: cacheIndex

This commit is contained in:
My-Responsitories
2025-12-24 01:05:59 +08:00
parent 1a8f65b075
commit 43c7620b4c

View File

@@ -28,8 +28,8 @@ class _BarSetPageState extends State<BarSetPage> {
.map((e) => Pair(first: e, second: cache?.contains(e.index) ?? true))
.toList();
if (cache != null && cache.isNotEmpty) {
final cacheIndex = {for (var (k, v) in cache.indexed) v: k};
list.sort((a, b) {
final cacheIndex = {for (var (k, v) in cache.indexed) v: k};
final indexA = cacheIndex[a.first.index] ?? cacheIndex.length;
final indexB = cacheIndex[b.first.index] ?? cacheIndex.length;
return indexA.compareTo(indexB);