feat: add course bar length setting and clear blue glass Dock

This commit is contained in:
Codex
2026-10-13 12:51:27 +08:00
parent 8403be05da
commit 9193fd8e43
11 changed files with 444 additions and 138 deletions
+7
View File
@@ -11,7 +11,12 @@ class AppSettings {
this.singleColorArgb = 0xFF348F91,
this.calendarEnabled = false,
this.calendarId,
this.courseHeightScale = defaultCourseHeightScale,
});
static const defaultCourseHeightScale = 1.25;
static const minCourseHeightScale = 0.8;
static const maxCourseHeightScale = 2.0;
final double courseHeightScale;
final Semester? semester;
final bool remindersEnabled, calendarEnabled;
final int reminderMinutes, singleColorArgb;
@@ -25,6 +30,7 @@ class AppSettings {
int? singleColorArgb,
bool? calendarEnabled,
String? calendarId,
double? courseHeightScale,
}) => AppSettings(
semester: semester ?? this.semester,
remindersEnabled: remindersEnabled ?? this.remindersEnabled,
@@ -33,5 +39,6 @@ class AppSettings {
singleColorArgb: singleColorArgb ?? this.singleColorArgb,
calendarEnabled: calendarEnabled ?? this.calendarEnabled,
calendarId: calendarId ?? this.calendarId,
courseHeightScale: courseHeightScale ?? this.courseHeightScale,
);
}
+11
View File
@@ -62,6 +62,7 @@ class AppSnapshot {
'singleColorArgb': settings.singleColorArgb,
'calendarEnabled': settings.calendarEnabled,
'calendarId': settings.calendarId,
'courseHeightScale': settings.courseHeightScale,
},
'importMetadata': importMetadata == null
? null
@@ -90,6 +91,15 @@ class AppSnapshot {
}
final color = s['singleColorArgb'] as int;
if (color < 0 || color > 0xFFFFFFFF) throw const FormatException('颜色无效');
final rawHeight = s.containsKey('courseHeightScale')
? s['courseHeightScale']
: AppSettings.defaultCourseHeightScale;
if (rawHeight is! num ||
!rawHeight.isFinite ||
rawHeight < AppSettings.minCourseHeightScale ||
rawHeight > AppSettings.maxCourseHeightScale) {
throw const FormatException('课程条长度无效');
}
final sem = s['semester'];
final term = sem == null
? null
@@ -110,6 +120,7 @@ class AppSnapshot {
singleColorArgb: color,
calendarEnabled: s['calendarEnabled'] as bool,
calendarId: s['calendarId'] as String?,
courseHeightScale: rawHeight.toDouble(),
),
importMetadata: metadata == null
? null