Introduce unified design tokens and migrate Home, Orders, and Statistics UI.
Establish AppColor/AppFont/AppSpacing/AppRadius theming, shared components, and design-system docs so pilot screens align with Android while keeping iOS-native spacing and touch targets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
54
suixinkan/Theme/AppFont.swift
Normal file
54
suixinkan/Theme/AppFont.swift
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// AppFont.swift
|
||||
// suixinkan
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
/// 应用字体层级,基于 8pt 网格与 SF Pro(System)。
|
||||
enum AppFont {
|
||||
|
||||
case caption
|
||||
case captionMedium
|
||||
case body
|
||||
case bodyMedium
|
||||
case subtitle
|
||||
case title
|
||||
case metric
|
||||
case display
|
||||
|
||||
/// 对应 UIFont。
|
||||
var uiFont: UIFont {
|
||||
switch self {
|
||||
case .caption:
|
||||
return .systemFont(ofSize: 12, weight: .regular)
|
||||
case .captionMedium:
|
||||
return .systemFont(ofSize: 12, weight: .medium)
|
||||
case .body:
|
||||
return .systemFont(ofSize: 14, weight: .regular)
|
||||
case .bodyMedium:
|
||||
return .systemFont(ofSize: 14, weight: .medium)
|
||||
case .subtitle:
|
||||
return .systemFont(ofSize: 16, weight: .medium)
|
||||
case .title:
|
||||
return .systemFont(ofSize: 16, weight: .bold)
|
||||
case .metric:
|
||||
return .systemFont(ofSize: 18, weight: .bold)
|
||||
case .display:
|
||||
return .systemFont(ofSize: 28, weight: .semibold)
|
||||
}
|
||||
}
|
||||
|
||||
/// 将字体应用到 UILabel。
|
||||
func apply(to label: UILabel) {
|
||||
label.font = uiFont
|
||||
}
|
||||
}
|
||||
|
||||
extension UIFont {
|
||||
|
||||
/// 通过 `AppFont` 获取系统字体。
|
||||
static func app(_ style: AppFont) -> UIFont {
|
||||
style.uiFont
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user