fix(app): 全链路验证修复 — 编译错误/CORS/迁移/启动脚本
Some checks failed
Main Merge / backend (push) Has been cancelled
Main Merge / frontend (push) Has been cancelled

前端修复:
- calendar_page: 移除不存在的 JournalEntry.content getter
- responsive_scaffold: 移除不存在的 notchThickness 参数
- splash_page: SingleTickerProvider → TickerProvider (多 AnimationController)
- profile_page: UserRoleType.name → .code (修复运行时崩溃)
- 导入缺失的 user.dart

后端修复:
- class_service: generate_class_code 取 UUID 后6位(随机部分)避免碰撞
- diary_role_seed: 移除不存在的 id 列,使用复合主键 ON CONFLICT

基础设施:
- config/default.toml: CORS 改为通配符(开发模式)
- scripts/dev.sh: 统一启动脚本(自动清理端口)
- docs/opendesign/: Open Design 设计规格 HTML 原型稿

验证结果: flutter analyze 0 error, cargo test 77/77 通过, 17个页面全部渲染正常
This commit is contained in:
iven
2026-06-02 01:03:58 +08:00
parent 749ef55b89
commit b320641d9c
56 changed files with 20696 additions and 239 deletions

View File

@@ -1,5 +1,6 @@
// 暖记色彩系统 — 7 色 × 浅色/深色模式
// 设计规格 v1.2
// 暖记色彩系统 — 完整设计 Token
// 对齐 Open Design 原型稿 tokens.css
// 浅色(暖阳) + 深色 + 松风主题色值
import 'package:flutter/material.dart';
@@ -7,7 +8,7 @@ import 'package:flutter/material.dart';
class AppColors {
AppColors._();
// ===== 浅色模式 =====
// ===== 核心七色 · 浅色模式(暖阳 Warm Sun=====
/// 奶油白背景 #FFF8F0
static const Color bgLight = Color(0xFFFFF8F0);
@@ -30,7 +31,45 @@ class AppColors {
/// 玫瑰粉 #D4A5A5
static const Color rose = Color(0xFFD4A5A5);
// ===== 色模式 =====
// ===== 中间色 · 浅色模式 =====
/// 次要文字 #5C4F47
static const Color fg2Light = Color(0xFF5C4F47);
/// 柔和/禁用文字 #7A6D63
static const Color mutedLight = Color(0xFF7A6D63);
/// 辅助说明文字 #8B7E74
static const Color metaLight = Color(0xFF8B7E74);
/// 边框 #E8DDD4
static const Color borderLight = Color(0xFFE8DDD4);
/// 柔和边框 #F0E8DF
static const Color borderSoftLight = Color(0xFFF0E8DF);
/// 主色悬停 #D06A4F
static const Color accentHover = Color(0xFFD06A4F);
/// 主色按下 #C05A3F
static const Color accentActive = Color(0xFFC05A3F);
/// 主色辉光 rgba(224,122,95,0.25)
static const Color accentGlow = Color(0x40E07A5F);
/// 温暖表面 #FFF3E6
static const Color surfaceWarmLight = Color(0xFFFFF3E6);
/// 鼠尾草绿柔和 #D4E8DC
static const Color secondarySoftLight = Color(0xFFD4E8DC);
/// 暖金柔和 #FBE8C8
static const Color tertiarySoftLight = Color(0xFFFBE8C8);
/// 玫瑰柔和 #F0DADA
static const Color roseSoftLight = Color(0xFFF0DADA);
// ===== 核心七色 · 深色模式 =====
/// 深色背景 #1A1614
static const Color bgDark = Color(0xFF1A1614);
@@ -53,20 +92,77 @@ class AppColors {
/// 深色玫瑰 #C4A0A0
static const Color roseDark = Color(0xFFC4A0A0);
// ===== 功能色 =====
// ===== 中间色 · 深色模式 =====
/// 错误红
static const Color error = Color(0xFFD32F2F);
/// 深色次要文字 #C4B8AA
static const Color fg2Dark = Color(0xFFC4B8AA);
/// 成功绿
static const Color success = Color(0xFF4CAF50);
/// 深色柔和文字 #9B8E82
static const Color mutedDark = Color(0xFF9B8E82);
/// 警告黄
static const Color warning = Color(0xFFFFA726);
/// 深色辅助文字 #7A6D63
static const Color metaDark = Color(0xFF7A6D63);
/// 信息蓝
/// 深色边框 #3A3530
static const Color borderDark = Color(0xFF3A3530);
/// 深色柔和边框 #302B26
static const Color borderSoftDark = Color(0xFF302B26);
/// 深色主色悬停 #D07A64
static const Color accentHoverDark = Color(0xFFD07A64);
/// 深色主色按下 #C06A54
static const Color accentActiveDark = Color(0xFFC06A54);
/// 深色主色辉光
static const Color accentGlowDark = Color(0x40E8907A);
/// 深色温暖表面 #332D28
static const Color surfaceWarmDark = Color(0xFF332D28);
/// 深色鼠尾草绿柔和 #2A3A2E
static const Color secondarySoftDark = Color(0xFF2A3A2E);
/// 深色暖金柔和 #302A1E
static const Color tertiarySoftDark = Color(0xFF302A1E);
/// 深色玫瑰柔和 #3A2A2A
static const Color roseSoftDark = Color(0xFF3A2A2A);
// ===== 功能色(对齐设计稿)=====
/// 错误/危险 #C93D3D
static const Color error = Color(0xFFC93D3D);
/// 成功 #5A9E7E
static const Color success = Color(0xFF5A9E7E);
/// 警告 #D4A843
static const Color warning = Color(0xFFD4A843);
/// 信息 #42A5F5
static const Color info = Color(0xFF42A5F5);
// ===== 功能色 · 深色模式 =====
/// 深色错误 #D94A4A
static const Color errorDark = Color(0xFFD94A4A);
/// 深色成功 #6AAF8E
static const Color successDark = Color(0xFF6AAF8E);
/// 深色警告 #C4A843
static const Color warningDark = Color(0xFFC4A843);
// ===== 阴影色调 =====
/// 浅色阴影 rgba(45,36,32,...)
static const Color shadowLight = Color(0xFF2D2420);
/// 深色阴影 rgba(0,0,0,...)
static const Color shadowDark = Color(0xFF000000);
// ===== 心情颜色映射 =====
/// 心情 → 颜色
@@ -78,17 +174,26 @@ class AppColors {
'thinking': Color(0xFFB8A9C9),// 🤔 思考 — 淡紫
};
/// 心情 → 日历背景色
static const Map<String, Color> moodCellColors = {
'happy': secondarySoftLight, // #D4E8DC
'love': roseSoftLight, // #F0DADA
'calm': tertiarySoftLight, // #FBE8C8
'sad': Color(0xFFD4DDE8), // 灰蓝
'tired': Color(0xFFE8E4E0), // 灰棕
};
// ===== 浅色主题色彩方案 =====
static const _light = ColorScheme(
brightness: Brightness.light,
primary: accent,
onPrimary: Colors.white,
onPrimary: Color(0xFFFFF8F0), // accent-on
primaryContainer: Color(0xFFFFE0D6),
onPrimaryContainer: fgLight,
secondary: secondary,
onSecondary: Colors.white,
secondaryContainer: Color(0xFFD4E8DC),
secondaryContainer: secondarySoftLight,
onSecondaryContainer: fgLight,
tertiary: tertiary,
onTertiary: fgLight,
@@ -96,6 +201,9 @@ class AppColors {
onError: Colors.white,
surface: surfaceLight,
onSurface: fgLight,
onSurfaceVariant: mutedLight, // 次要文字
outline: borderLight, // 边框
outlineVariant: borderSoftLight, // 柔和边框
surfaceContainerHighest: bgLight,
);
@@ -104,19 +212,22 @@ class AppColors {
static const _dark = ColorScheme(
brightness: Brightness.dark,
primary: accentDark,
onPrimary: fgDark,
onPrimary: Color(0xFF1A1614), // accent-on dark
primaryContainer: Color(0xFF5A2E22),
onPrimaryContainer: Color(0xFFFFD6CC),
secondary: secondaryDark,
onSecondary: fgDark,
secondaryContainer: Color(0xFF2A4A38),
secondaryContainer: secondarySoftDark,
onSecondaryContainer: Color(0xFFD4E8DC),
tertiary: tertiaryDark,
onTertiary: fgDark,
error: Color(0xFFEF5350),
error: errorDark,
onError: fgDark,
surface: surfaceDark,
onSurface: fgDark,
onSurfaceVariant: mutedDark,
outline: borderDark,
outlineVariant: borderSoftDark,
surfaceContainerHighest: bgDark,
);

View File

@@ -1,11 +1,15 @@
// 暖记圆角系统
// 设计规格: 10 / 16 / 22 / 28 / pill
// 对齐 Open Design 原型稿 tokens.css: xs(8) / sm(10) / md(16) / lg(22) / xl(28) / pill
import 'package:flutter/material.dart';
class AppRadius {
AppRadius._();
/// 极小圆角 8px — 小型元素
static const double xs = 8;
static BorderRadius get xsBorder => BorderRadius.circular(xs);
/// 小圆角 10px — 按钮、输入框
static const double sm = 10;
static BorderRadius get smBorder => BorderRadius.circular(sm);

View File

@@ -1,4 +1,5 @@
// 暖记主题入口 — 浅色/深色 ThemeData
// 对齐 Open Design 原型稿设计系统
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@@ -44,7 +45,7 @@ class AppTheme {
shape: RoundedRectangleBorder(
borderRadius: AppRadius.mdBorder,
side: BorderSide(
color: colorScheme.outlineVariant.withValues(alpha: 0.3),
color: colorScheme.outlineVariant,
),
),
color: colorScheme.surface,
@@ -102,7 +103,7 @@ class AppTheme {
bottomNavigationBarTheme: BottomNavigationBarThemeData(
type: BottomNavigationBarType.fixed,
selectedItemColor: colorScheme.primary,
unselectedItemColor: colorScheme.onSurface.withValues(alpha: 0.5),
unselectedItemColor: colorScheme.onSurfaceVariant,
backgroundColor: colorScheme.surface,
elevation: 8,
),
@@ -115,15 +116,15 @@ class AppTheme {
side: BorderSide.none,
),
// FloatingActionButton
// FloatingActionButton — 珊瑚色圆形凸起
floatingActionButtonTheme: FloatingActionButtonThemeData(
shape: RoundedRectangleBorder(
borderRadius: AppRadius.mdBorder,
),
backgroundColor: isLight ? AppColors.accent : AppColors.accentDark,
foregroundColor: isLight ? const Color(0xFFFFF8F0) : const Color(0xFF1A1614),
shape: const CircleBorder(),
elevation: 4,
),
// Page transitions — 弹性曲线
// Page transitions — 弹性曲线 cubic-bezier(0.34, 1.56, 0.64, 1)
pageTransitionsTheme: PageTransitionsTheme(
builders: {
TargetPlatform.android: _WarmCurveBuilder(),

View File

@@ -1,4 +1,6 @@
// 暖记字体系统 — Noto Sans SC + Caveat
// 暖记字体系统 — Quicksand(标题) + Nunito(正文) + Caveat(手写装饰)
// 对齐 Open Design 原型稿 tokens.css
// 字体文件待下载,当前系统字体回退
import 'package:flutter/material.dart';
@@ -6,99 +8,102 @@ class AppTypography {
AppTypography._();
/// 字体族
static const String displayFont = 'Caveat'; // 手写风格(标题装饰
static const String bodyFont = 'NotoSansSC'; // 正文(中文优先
static const String monoFont = 'JetBrains Mono'; // 等宽(暂用系统回退
static const String displayFont = 'Quicksand'; // 标题显示(待下载,系统回退 sans-serif
static const String bodyFont = 'Nunito'; // 正文(待下载,系统回退 sans-serif
static const String handwrittenFont = 'Caveat'; // 手写装饰(已有字体文件
static const String cjkFont = 'NotoSansSC'; // CJK 回退(已有字体文件)
static const String monoFont = 'JetBrains Mono'; // 等宽(暂用系统回退)
/// 浅色主题文字主题
/// 字号对齐设计稿: xs=11, sm=13, base=15, md=17, lg=20, xl=24, 2xl=30, 3xl=38, 4xl=48
static TextTheme lightTextTheme() => TextTheme(
// 大标题 — 手写风格
// Display — Quicksand 标题(对应 text-3xl / text-4xl
displayLarge: TextStyle(
fontFamily: displayFont,
fontSize: 57,
fontSize: 48,
height: 1.12,
fontWeight: FontWeight.w700,
),
displayMedium: TextStyle(
fontFamily: displayFont,
fontSize: 45,
fontSize: 38,
height: 1.16,
fontWeight: FontWeight.w700,
),
displaySmall: TextStyle(
fontFamily: displayFont,
fontSize: 36,
height: 1.22,
fontSize: 30,
height: 1.2,
fontWeight: FontWeight.w700,
),
// 标题 — 正文衬线
// Headline — Nunito 标题(对应 text-xl / text-2xl
headlineLarge: TextStyle(
fontFamily: bodyFont,
fontSize: 32,
fontSize: 30,
height: 1.25,
fontWeight: FontWeight.w700,
),
headlineMedium: TextStyle(
fontFamily: bodyFont,
fontSize: 28,
fontSize: 24,
height: 1.29,
fontWeight: FontWeight.w600,
),
headlineSmall: TextStyle(
fontFamily: bodyFont,
fontSize: 24,
height: 1.33,
fontSize: 20,
height: 1.3,
fontWeight: FontWeight.w600,
),
// 副标题
// Title — Nunito 副标题(对应 text-md / text-base
titleLarge: TextStyle(
fontFamily: bodyFont,
fontSize: 22,
height: 1.27,
fontSize: 17,
height: 1.3,
fontWeight: FontWeight.w600,
),
titleMedium: TextStyle(
fontFamily: bodyFont,
fontSize: 16,
height: 1.5,
fontSize: 15,
height: 1.6,
fontWeight: FontWeight.w600,
),
titleSmall: TextStyle(
fontFamily: bodyFont,
fontSize: 14,
height: 1.43,
fontSize: 13,
height: 1.4,
fontWeight: FontWeight.w600,
),
// 正文
// Body — Nunito 正文(对应 text-base / text-sm
bodyLarge: TextStyle(
fontFamily: bodyFont,
fontSize: 16,
height: 1.5,
fontSize: 15,
height: 1.6,
fontWeight: FontWeight.w400,
),
bodyMedium: TextStyle(
fontFamily: bodyFont,
fontSize: 14,
height: 1.43,
fontSize: 15,
height: 1.6,
fontWeight: FontWeight.w400,
),
bodySmall: TextStyle(
fontFamily: bodyFont,
fontSize: 12,
height: 1.33,
fontSize: 13,
height: 1.6,
fontWeight: FontWeight.w400,
),
// 标签
// Label — Nunito 标签(对应 text-base / text-sm / text-xs
labelLarge: TextStyle(
fontFamily: bodyFont,
fontSize: 14,
height: 1.43,
fontSize: 15,
height: 1.6,
fontWeight: FontWeight.w500,
),
labelMedium: TextStyle(
fontFamily: bodyFont,
fontSize: 12,
height: 1.33,
fontSize: 13,
height: 1.6,
fontWeight: FontWeight.w500,
),
labelSmall: TextStyle(
@@ -109,6 +114,6 @@ class AppTypography {
),
);
/// 深色主题文字主题
/// 深色主题文字主题(与浅色共享字号,颜色由 ColorScheme 控制)
static TextTheme darkTextTheme() => lightTextTheme();
}