feat: 饮食记录逻辑重构 + 通知管理分隔线修复 + 多页面 UI 调整
- 饮食: 新增 DietCommentaryPolicy + diet_record_logic, 饮食记录逻辑抽取复用 - 通知管理: 分隔线改为仿通知中心样式, 跳过图标区域只留文字下方 - 侧边栏: 对话记录操作栏浮层修复 + 常用功能间距收紧 - 智能体: 欢迎卡片去 400ms 延迟 + 胶囊去阴影 - 后端: AI 会话仓库新增方法 + 饮食评论策略 + 健康记录规则调整 - 其他: api_client IP 适配 + 多页面 UI 微调 + 新增测试
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../core/app_design_tokens.dart';
|
||||
import '../../core/app_module_visuals.dart';
|
||||
import '../../core/app_theme.dart';
|
||||
import '../../core/navigation_provider.dart';
|
||||
import '../../providers/data_providers.dart';
|
||||
@@ -19,8 +18,6 @@ class MedicationEditPage extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _MedicationEditPageState extends ConsumerState<MedicationEditPage> {
|
||||
static const _visual = AppModuleVisuals.medication;
|
||||
|
||||
final _nameCtrl = TextEditingController();
|
||||
final _dosageCtrl = TextEditingController();
|
||||
final _notesCtrl = TextEditingController();
|
||||
@@ -202,7 +199,7 @@ class _MedicationEditPageState extends ConsumerState<MedicationEditPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.mdBorder,
|
||||
border: Border.all(color: _visual.borderColor, width: 1),
|
||||
border: Border.all(color: AppColors.border, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
'${_times[i].hour.toString().padLeft(2, '0')}:${_times[i].minute.toString().padLeft(2, '0')}',
|
||||
@@ -235,19 +232,9 @@ class _MedicationEditPageState extends ConsumerState<MedicationEditPage> {
|
||||
const SizedBox(height: 16),
|
||||
_field('备注', _notesCtrl, hint: '如:饭后服用、睡前'),
|
||||
const SizedBox(height: 32),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: _loading ? null : _save,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: _visual.color,
|
||||
side: BorderSide(color: _visual.color, width: 1.5),
|
||||
shape: RoundedRectangleBorder(borderRadius: AppRadius.lgBorder),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
),
|
||||
child: Text(_loading ? '保存中...' : '保存', style: AppTextStyles.button),
|
||||
),
|
||||
_GradientOutlineButton(
|
||||
onPressed: _loading ? null : _save,
|
||||
label: _loading ? '保存中...' : '保存',
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
@@ -271,7 +258,7 @@ class _MedicationEditPageState extends ConsumerState<MedicationEditPage> {
|
||||
fillColor: AppTheme.surface,
|
||||
border: _inputBorder(AppColors.border),
|
||||
enabledBorder: _inputBorder(AppColors.border),
|
||||
focusedBorder: _inputBorder(_visual.color),
|
||||
focusedBorder: _inputBorder(AppColors.primary),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 12,
|
||||
@@ -377,6 +364,57 @@ class _PickerBox extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _GradientOutlineButton extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
final String label;
|
||||
|
||||
const _GradientOutlineButton({required this.onPressed, required this.label});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final enabled = onPressed != null;
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
gradient: enabled ? AppColors.actionOutlineGradient : null,
|
||||
color: enabled ? null : AppColors.border,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
),
|
||||
padding: const EdgeInsets.all(1.4),
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
child: InkWell(
|
||||
onTap: onPressed,
|
||||
borderRadius: AppRadius.lgBorder,
|
||||
child: SizedBox(
|
||||
height: 46,
|
||||
child: Center(
|
||||
child: enabled
|
||||
? ShaderMask(
|
||||
shaderCallback: (bounds) =>
|
||||
AppColors.actionOutlineGradient.createShader(bounds),
|
||||
child: Text(
|
||||
label,
|
||||
style: AppTextStyles.button.copyWith(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
label,
|
||||
style: AppTextStyles.button.copyWith(
|
||||
color: AppColors.textHint,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _displayDate(DateTime date) {
|
||||
return '${date.year}/${date.month.toString().padLeft(2, '0')}/${date.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user