feat: A1 短材料复现本单元理解词,并加入黑夜模式
课程内容 - 重写全部 21 个 A1 单元的听读材料,把本单元理解词织进听/读文本, 单元内理解词复现率从约 20% 提升到约 77%(各单元 56–96%)。 - 修正 U01 房间号与机场大巴同为 thirty 的撞车(改为 17/30/40)。 - 校验器容差按级别读取(A1 为 8%),materials 覆盖率、字数、 选项子串等校验全部通过;course_content_test 通过。 黑夜模式 - app_theme 拆分明/暗两套调色板,AppColors 随亮度切换; main 用 theme/darkTheme/themeMode + builder 镜像已解析亮度; 主题偏好持久化到快照;进度页新增“外观主题”切换。 文档 - COURSE-PACK-JSON.md 更新 A1 词池覆盖(840/933)与材料复现约定。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9ab08c25ef
commit
febfd30f49
@@ -1,57 +1,136 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract final class AppColors {
|
||||
static const paper = Color(0xFFF5F7F3);
|
||||
static const surface = Colors.white;
|
||||
static const surfaceMuted = Color(0xFFF1F5F0);
|
||||
static const ink = Color(0xFF19211B);
|
||||
static const muted = Color(0xFF647268);
|
||||
static const line = Color(0xFFD8E1D9);
|
||||
static const green = Color(0xFF176B46);
|
||||
static const softGreen = Color(0xFFE2F3E8);
|
||||
static const warm = Color(0xFFFFF0E3);
|
||||
static const warmInk = Color(0xFF9E4C18);
|
||||
/// User's theme preference, persisted in the learning snapshot.
|
||||
enum AppThemeMode { system, light, dark }
|
||||
|
||||
/// One brightness worth of brand colours. Two const instances below hold the
|
||||
/// light and dark values; [AppColors] mirrors the active one so the many
|
||||
/// widgets that read `AppColors.x` directly recolour when the theme changes.
|
||||
class _Palette {
|
||||
const _Palette({
|
||||
required this.paper,
|
||||
required this.surface,
|
||||
required this.surfaceMuted,
|
||||
required this.ink,
|
||||
required this.muted,
|
||||
required this.line,
|
||||
required this.green,
|
||||
required this.softGreen,
|
||||
required this.warm,
|
||||
required this.warmInk,
|
||||
});
|
||||
|
||||
final Color paper;
|
||||
final Color surface;
|
||||
final Color surfaceMuted;
|
||||
final Color ink;
|
||||
final Color muted;
|
||||
final Color line;
|
||||
final Color green;
|
||||
final Color softGreen;
|
||||
final Color warm;
|
||||
final Color warmInk;
|
||||
}
|
||||
|
||||
ThemeData buildAppTheme() {
|
||||
const _light = _Palette(
|
||||
paper: Color(0xFFF5F7F3),
|
||||
surface: Colors.white,
|
||||
surfaceMuted: Color(0xFFF1F5F0),
|
||||
ink: Color(0xFF19211B),
|
||||
muted: Color(0xFF647268),
|
||||
line: Color(0xFFD8E1D9),
|
||||
green: Color(0xFF176B46),
|
||||
softGreen: Color(0xFFE2F3E8),
|
||||
warm: Color(0xFFFFF0E3),
|
||||
warmInk: Color(0xFF9E4C18),
|
||||
);
|
||||
|
||||
const _dark = _Palette(
|
||||
paper: Color(0xFF11150F),
|
||||
surface: Color(0xFF1B211A),
|
||||
surfaceMuted: Color(0xFF232B22),
|
||||
ink: Color(0xFFE8EEE6),
|
||||
muted: Color(0xFF9CA99D),
|
||||
line: Color(0xFF33402F),
|
||||
green: Color(0xFF2FA36B),
|
||||
softGreen: Color(0xFF17311F),
|
||||
warm: Color(0xFF352618),
|
||||
warmInk: Color(0xFFEBAA78),
|
||||
);
|
||||
|
||||
/// Brand colours for the active brightness. Values are reassigned by
|
||||
/// [AppColors.applyBrightness]; call it before building the widget tree.
|
||||
abstract final class AppColors {
|
||||
static Color paper = _light.paper;
|
||||
static Color surface = _light.surface;
|
||||
static Color surfaceMuted = _light.surfaceMuted;
|
||||
static Color ink = _light.ink;
|
||||
static Color muted = _light.muted;
|
||||
static Color line = _light.line;
|
||||
static Color green = _light.green;
|
||||
static Color softGreen = _light.softGreen;
|
||||
static Color warm = _light.warm;
|
||||
static Color warmInk = _light.warmInk;
|
||||
|
||||
static Brightness brightness = Brightness.light;
|
||||
|
||||
static void applyBrightness(Brightness value) {
|
||||
final p = value == Brightness.dark ? _dark : _light;
|
||||
brightness = value;
|
||||
paper = p.paper;
|
||||
surface = p.surface;
|
||||
surfaceMuted = p.surfaceMuted;
|
||||
ink = p.ink;
|
||||
muted = p.muted;
|
||||
line = p.line;
|
||||
green = p.green;
|
||||
softGreen = p.softGreen;
|
||||
warm = p.warm;
|
||||
warmInk = p.warmInk;
|
||||
}
|
||||
}
|
||||
|
||||
ThemeData buildAppTheme(Brightness brightness) {
|
||||
final p = brightness == Brightness.dark ? _dark : _light;
|
||||
final scheme =
|
||||
ColorScheme.fromSeed(
|
||||
seedColor: AppColors.green,
|
||||
brightness: Brightness.light,
|
||||
seedColor: p.green,
|
||||
brightness: brightness,
|
||||
).copyWith(
|
||||
surface: AppColors.surface,
|
||||
onSurface: AppColors.ink,
|
||||
primary: AppColors.green,
|
||||
surface: p.surface,
|
||||
onSurface: p.ink,
|
||||
primary: p.green,
|
||||
onPrimary: Colors.white,
|
||||
outline: AppColors.line,
|
||||
outline: p.line,
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: brightness,
|
||||
colorScheme: scheme,
|
||||
scaffoldBackgroundColor: AppColors.paper,
|
||||
scaffoldBackgroundColor: p.paper,
|
||||
fontFamily: 'PingFang SC',
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: AppColors.surface,
|
||||
foregroundColor: AppColors.ink,
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: p.surface,
|
||||
foregroundColor: p.ink,
|
||||
elevation: 0,
|
||||
centerTitle: false,
|
||||
),
|
||||
textTheme: const TextTheme(
|
||||
textTheme: TextTheme(
|
||||
headlineMedium: TextStyle(
|
||||
color: AppColors.ink,
|
||||
color: p.ink,
|
||||
fontSize: 26,
|
||||
height: 1.25,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.6,
|
||||
),
|
||||
titleLarge: TextStyle(
|
||||
color: AppColors.ink,
|
||||
color: p.ink,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
bodyLarge: TextStyle(color: AppColors.ink, fontSize: 16, height: 1.5),
|
||||
bodyMedium: TextStyle(color: AppColors.muted, fontSize: 14, height: 1.5),
|
||||
bodyLarge: TextStyle(color: p.ink, fontSize: 16, height: 1.5),
|
||||
bodyMedium: TextStyle(color: p.muted, fontSize: 14, height: 1.5),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user