fix get block color

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-14 15:57:57 +08:00
parent 1cd949c365
commit f46437f891

View File

@@ -107,7 +107,7 @@ abstract class Pref {
static List<Pair<SegmentType, SkipType>> get blockSettings { static List<Pair<SegmentType, SkipType>> get blockSettings {
final list = _setting.get(SettingBoxKey.blockSettings) as List?; final list = _setting.get(SettingBoxKey.blockSettings) as List?;
if (list == null) { if (list == null || list.length != SegmentType.values.length) {
return SegmentType.values return SegmentType.values
.map((i) => Pair(first: i, second: SkipType.skipOnce)) .map((i) => Pair(first: i, second: SkipType.skipOnce))
.toList(); .toList();
@@ -116,8 +116,7 @@ abstract class Pref {
.map( .map(
(item) => Pair( (item) => Pair(
first: item, first: item,
second: SkipType second: SkipType.values[list[item.index]],
.values[list.getOrNull(item.index) ?? SkipType.skipOnce.index],
), ),
) )
.toList(); .toList();
@@ -125,7 +124,7 @@ abstract class Pref {
static List<Color> get blockColor { static List<Color> get blockColor {
final list = _setting.get(SettingBoxKey.blockColor) as List?; final list = _setting.get(SettingBoxKey.blockColor) as List?;
if (list == null) { if (list == null || list.length != SegmentType.values.length) {
return SegmentType.values.map((i) => i.color).toList(); return SegmentType.values.map((i) => i.color).toList();
} }
return SegmentType.values.map( return SegmentType.values.map(