fix: 欢迎卡片UI优化 + 蓝牙录入按钮 + 多处修复

- 欢迎卡片:去掉白框圆角错位、图片满宽、按钮去箭头改圆角居中
- 渐变actionOutlineGradient改紫蓝双色循环
- 新增健康Agent"蓝牙录入"按钮→蓝牙设备页
- "查看健康情况"改名"健康概览"
- 饮食编辑框删除bug修复(控制器缓存)
- 启动脚本加adb reverse自动转发
- 登录闪屏修复
This commit is contained in:
MingNian
2026-06-17 10:58:59 +08:00
parent 9279b7e283
commit 4f1ad82345
28 changed files with 1641 additions and 1098 deletions

View File

@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../core/navigation_provider.dart';
import '../../core/app_colors.dart';
import '../../core/app_theme.dart';
import '../../providers/auth_provider.dart';
import '../../utils/sse_handler.dart';
@@ -303,7 +304,6 @@ class DietNotifier extends Notifier<DietState> {
// ─────────── 饮食主题色(暖橙系,不再用紫色)───────────
const _dietAccent = AppColors.primary;
const _dietAccentLight = AppColors.primarySoft;
const _dietBg = AppColors.background;
class DietCapturePage extends ConsumerStatefulWidget {
const DietCapturePage({super.key});
@@ -320,10 +320,9 @@ class _DietCapturePageState extends ConsumerState<DietCapturePage> {
@override
Widget build(BuildContext context) {
final state = ref.watch(dietProvider);
return Scaffold(
backgroundColor: _dietBg,
return GradientScaffold(
appBar: AppBar(
backgroundColor: Colors.white,
backgroundColor: Colors.white.withValues(alpha: 0.9),
title: const Text(
'饮食分析',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600),
@@ -352,13 +351,22 @@ class _DietCapturePageState extends ConsumerState<DietCapturePage> {
child: Column(
children: [
// 图片自适应显示
ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Image.file(
File(state.imagePath!),
width: screenW - 32,
height: 220,
fit: BoxFit.cover,
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(24),
border: Border.all(color: AppColors.borderLight),
boxShadow: AppColors.cardShadowLight,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: Image.file(
File(state.imagePath!),
width: screenW - 48,
height: 220,
fit: BoxFit.cover,
),
),
),
const SizedBox(height: 16),
@@ -398,9 +406,9 @@ class _DietCapturePageState extends ConsumerState<DietCapturePage> {
return Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white,
gradient: AppColors.surfaceGradient,
borderRadius: BorderRadius.circular(14),
border: Border.all(color: AppColors.border),
border: Border.all(color: AppColors.borderLight),
boxShadow: AppColors.cardShadowLight,
),
child: Row(
@@ -413,7 +421,8 @@ class _DietCapturePageState extends ConsumerState<DietCapturePage> {
duration: const Duration(milliseconds: 200),
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
color: sel ? _dietAccentLight : Colors.white,
gradient: sel ? AppColors.warmCareGradient : null,
color: sel ? null : Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: Column(
@@ -426,7 +435,7 @@ class _DietCapturePageState extends ConsumerState<DietCapturePage> {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: sel ? _dietAccent : AppColors.textHint,
color: sel ? Colors.white : AppColors.textHint,
),
),
],
@@ -876,28 +885,40 @@ class _DietCapturePageState extends ConsumerState<DietCapturePage> {
// ─────────── 保存按钮 ───────────
Widget _buildSaveButton() {
return SizedBox(
return Container(
width: double.infinity,
height: 52,
child: ElevatedButton.icon(
onPressed: () async {
try {
await ref.read(dietProvider.notifier).saveRecord();
if (mounted) popRoute(ref);
} catch (e) {
debugPrint('[Diet] 保存记录失败: $e');
}
},
icon: const Icon(Icons.check_circle_outline, size: 22),
label: const Text(
'保存记录',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600),
),
style: ElevatedButton.styleFrom(
backgroundColor: _dietAccent,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
decoration: BoxDecoration(
gradient: AppColors.warmCareGradient,
borderRadius: BorderRadius.circular(16),
boxShadow: AppColors.buttonShadow,
),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () async {
try {
await ref.read(dietProvider.notifier).saveRecord();
if (mounted) popRoute(ref);
} catch (e) {
debugPrint('[Diet] 保存记录失败: $e');
}
},
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.check_circle_outline, size: 22, color: Colors.white),
SizedBox(width: 8),
Text(
'保存记录',
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.w800,
color: Colors.white,
),
),
],
),
),
),