feat: 饮食记录逻辑重构 + 通知管理分隔线修复 + 多页面 UI 调整
- 饮食: 新增 DietCommentaryPolicy + diet_record_logic, 饮食记录逻辑抽取复用 - 通知管理: 分隔线改为仿通知中心样式, 跳过图标区域只留文字下方 - 侧边栏: 对话记录操作栏浮层修复 + 常用功能间距收紧 - 智能体: 欢迎卡片去 400ms 延迟 + 胶囊去阴影 - 后端: AI 会话仓库新增方法 + 饮食评论策略 + 健康记录规则调整 - 其他: api_client IP 适配 + 多页面 UI 微调 + 新增测试
This commit is contained in:
93
health_app/lib/widgets/app_gradient_widgets.dart
Normal file
93
health_app/lib/widgets/app_gradient_widgets.dart
Normal file
@@ -0,0 +1,93 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../core/app_colors.dart';
|
||||
|
||||
class AppGradientText extends StatelessWidget {
|
||||
final String text;
|
||||
final TextStyle style;
|
||||
final Gradient gradient;
|
||||
final TextAlign? textAlign;
|
||||
|
||||
const AppGradientText(
|
||||
this.text, {
|
||||
super.key,
|
||||
required this.style,
|
||||
this.gradient = AppColors.primaryGradient,
|
||||
this.textAlign,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ShaderMask(
|
||||
shaderCallback: gradient.createShader,
|
||||
blendMode: BlendMode.srcIn,
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: textAlign,
|
||||
style: style.copyWith(color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppGradientIcon extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final double size;
|
||||
final Gradient gradient;
|
||||
|
||||
const AppGradientIcon({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.size,
|
||||
this.gradient = AppColors.primaryGradient,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ShaderMask(
|
||||
shaderCallback: gradient.createShader,
|
||||
blendMode: BlendMode.srcIn,
|
||||
child: Icon(icon, size: size, color: Colors.white),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppGradientOutlineButton extends StatelessWidget {
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final Gradient gradient;
|
||||
|
||||
const AppGradientOutlineButton({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
this.gradient = AppColors.primaryGradient,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
gradient: gradient,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
),
|
||||
padding: const EdgeInsets.all(1.2),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
),
|
||||
child: AppGradientText(
|
||||
label,
|
||||
gradient: gradient,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w800),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user