- 全新"朝露"主题:深青绿主色(#2D6A4F),暖白底,完整设计Token - 引入 shadcn_ui 组件库,MaterialApp 注入 ShadTheme - 新增 4 个公共组件:AppCard、AppMenuItem、AppEmptyState、AppTabChip - 全面消除硬编码颜色,统一使用 AppTheme Token - 全局字号 +3~4pt,图标等比放大 +3px - home/medication/profile/settings/login 等核心页面重写 - 路由和功能逻辑零改动
47 lines
1.2 KiB
Dart
47 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
|
import '../core/app_theme.dart';
|
|
|
|
/// 统一样式的清新卡片
|
|
class AppCard extends StatelessWidget {
|
|
final Widget child;
|
|
final EdgeInsetsGeometry? padding;
|
|
final EdgeInsetsGeometry? margin;
|
|
final VoidCallback? onTap;
|
|
final Color? backgroundColor;
|
|
final BorderRadius? borderRadius;
|
|
|
|
const AppCard({
|
|
super.key,
|
|
required this.child,
|
|
this.padding = const EdgeInsets.all(AppTheme.sLg),
|
|
this.margin,
|
|
this.onTap,
|
|
this.backgroundColor,
|
|
this.borderRadius,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = ShadTheme.of(context);
|
|
final card = Container(
|
|
margin: margin ?? const EdgeInsets.symmetric(horizontal: AppTheme.sLg, vertical: AppTheme.sSm),
|
|
padding: padding,
|
|
decoration: BoxDecoration(
|
|
color: backgroundColor ?? theme.colorScheme.card,
|
|
borderRadius: borderRadius ?? BorderRadius.circular(AppTheme.rMd),
|
|
boxShadow: [AppTheme.shadowLight],
|
|
),
|
|
child: child,
|
|
);
|
|
|
|
if (onTap != null) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: card,
|
|
);
|
|
}
|
|
return card;
|
|
}
|
|
}
|