refactor(theme): 扩展AppTheme支持卡片样式和圆角风格动态配置 feat(services): 新增HapticService触觉反馈服务 feat(services): 实现ScreenWakeService屏幕常亮管理 feat(services): 添加SoundService音效播放服务 feat(services): 集成AppLockService应用锁功能 feat(services): 实现BatteryOptimizationService电池优化 feat(services): 新增NetworkProxyService网络代理 feat(services): 完善DataExportService数据导出 feat(services): 增强PermissionService权限管理 feat(tools): 工具中心新增拼音转换等多项功能 fix(localization): 修复时区初始化错误 docs: 更新工具中心开发清单和设置重构文档 chore: 更新依赖版本和CI配置
73 lines
2.3 KiB
Dart
73 lines
2.3 KiB
Dart
/// ============================================================
|
|
/// 闲言APP — 圆角令牌
|
|
/// 创建时间: 2026-04-20
|
|
/// 更新时间: 2026-05-07
|
|
/// 作用: 统一圆角定义 — 支持动态圆角风格
|
|
/// 上次更新: 新增of(context)动态读取cornerRadiusId
|
|
/// ============================================================
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'app_theme.dart';
|
|
|
|
class AppRadius {
|
|
AppRadius._();
|
|
|
|
static const double xs = 2.0;
|
|
static const double sm = 4.0;
|
|
static const double md = 8.0;
|
|
static const double lg = 12.0;
|
|
static const double xl = 16.0;
|
|
static const double full = 999.0;
|
|
|
|
static BorderRadius get xsBorder => BorderRadius.circular(xs);
|
|
static BorderRadius get smBorder => BorderRadius.circular(sm);
|
|
static BorderRadius get mdBorder => BorderRadius.circular(md);
|
|
static BorderRadius get lgBorder => BorderRadius.circular(lg);
|
|
static BorderRadius get xlBorder => BorderRadius.circular(xl);
|
|
static BorderRadius get fullBorder => BorderRadius.circular(full);
|
|
static BorderRadius get pillBorder => fullBorder;
|
|
|
|
static AppRadiusData of(BuildContext context) {
|
|
final ext = AppTheme.ext(context);
|
|
final id = ext.cornerRadiusId;
|
|
return AppRadiusData._fromId(id);
|
|
}
|
|
}
|
|
|
|
class AppRadiusData {
|
|
const AppRadiusData({
|
|
required this.xs,
|
|
required this.sm,
|
|
required this.md,
|
|
required this.lg,
|
|
required this.xl,
|
|
});
|
|
|
|
factory AppRadiusData._fromId(String id) {
|
|
return switch (id) {
|
|
'compact' => const AppRadiusData(xs: 1, sm: 2, md: 4, lg: 8, xl: 12),
|
|
'rounded' => const AppRadiusData(xs: 4, sm: 8, md: 12, lg: 16, xl: 20),
|
|
'super' => const AppRadiusData(xs: 6, sm: 12, md: 16, lg: 20, xl: 24),
|
|
_ => const AppRadiusData(xs: 2, sm: 4, md: 8, lg: 12, xl: 16),
|
|
};
|
|
}
|
|
|
|
final double xs;
|
|
final double sm;
|
|
final double md;
|
|
final double lg;
|
|
final double xl;
|
|
|
|
static const double full = 999.0;
|
|
|
|
BorderRadius get xsBorder => BorderRadius.circular(xs);
|
|
BorderRadius get smBorder => BorderRadius.circular(sm);
|
|
BorderRadius get mdBorder => BorderRadius.circular(md);
|
|
BorderRadius get lgBorder => BorderRadius.circular(lg);
|
|
BorderRadius get xlBorder => BorderRadius.circular(xl);
|
|
BorderRadius get fullBorder => BorderRadius.circular(full);
|
|
BorderRadius get pillBorder => fullBorder;
|
|
}
|