feat: UI 系统中心化 + 趋势图重构 + 法律文档 H5 上线
- UI 系统: 新增 design_tokens / module_visuals / app_buttons / app_status_badge / app_toast / ai_content 六个共享模块; 28 个页面接入, SnackBar 全部替换为 AppToast - 趋势图: 直线折线 + 渐变填充 + 阴影; 去网格线; X 轴日+月份分隔; Y 轴整数刻度最多 4 个; 点击数据点/录入记录显示上方浮层, 选中点变实心 - 法律文档 H5: 后端 wwwroot 托管隐私政策/服务协议/关于/个人信息收集清单/第三方 SDK 清单 + 索引页; Program.cs 启用 UseDefaultFiles + UseStaticFiles - 其他: auth_provider 登录流程调整; api_client IP 适配; 主页智能体栏间距优化
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../core/app_colors.dart';
|
||||
import '../core/app_design_tokens.dart';
|
||||
import '../core/navigation_provider.dart';
|
||||
import '../providers/auth_provider.dart';
|
||||
import '../providers/chat_provider.dart';
|
||||
import '../providers/conversation_history_provider.dart';
|
||||
import 'app_toast.dart';
|
||||
import '../providers/data_providers.dart';
|
||||
import 'drawer_shell.dart';
|
||||
|
||||
@@ -23,7 +26,7 @@ class HealthDrawer extends ConsumerWidget {
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(18, 18, 18, 24),
|
||||
padding: const EdgeInsets.fromLTRB(12, 16, 12, 24),
|
||||
sliver: SliverList.list(
|
||||
children: [
|
||||
_AccountHeader(user: auth.user, ref: ref),
|
||||
@@ -305,71 +308,66 @@ class _NavigationSection extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final items = [
|
||||
_NavItem(
|
||||
icon: Icons.folder_shared_rounded,
|
||||
icon: LucideIcons.folderHeart,
|
||||
title: '档案',
|
||||
route: 'healthArchive',
|
||||
colors: const [Color(0xFF93C5FD), Color(0xFF60A5FA)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.description_rounded,
|
||||
icon: LucideIcons.fileText,
|
||||
title: '报告',
|
||||
route: 'reports',
|
||||
colors: const [Color(0xFFBFDBFE), Color(0xFF93C5FD)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.medication_rounded,
|
||||
icon: LucideIcons.pill,
|
||||
title: '用药',
|
||||
route: 'medications',
|
||||
colors: const [Color(0xFFDDD6FE), Color(0xFFC4B5FD)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.restaurant_rounded,
|
||||
icon: LucideIcons.utensils,
|
||||
title: '饮食',
|
||||
route: 'dietRecords',
|
||||
colors: const [Color(0xFFFBCFE8), Color(0xFFF472B6)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.calendar_month_rounded,
|
||||
icon: LucideIcons.calendarDays,
|
||||
title: '日历',
|
||||
route: 'calendar',
|
||||
colors: const [Color(0xFFC4B5FD), Color(0xFF8B5CF6)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.event_available_rounded,
|
||||
icon: LucideIcons.calendarCheck,
|
||||
title: '随访',
|
||||
route: 'followups',
|
||||
colors: const [Color(0xFFFBCFE8), Color(0xFFF9A8D4)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.directions_run_rounded,
|
||||
icon: LucideIcons.footprints,
|
||||
title: '运动',
|
||||
route: 'exercisePlan',
|
||||
colors: const [Color(0xFFA5F3FC), Color(0xFF67E8F9)],
|
||||
),
|
||||
_NavItem(
|
||||
icon: Icons.bluetooth_connected_rounded,
|
||||
title: '蓝牙设备',
|
||||
icon: LucideIcons.bluetooth,
|
||||
title: '设备',
|
||||
route: 'devices',
|
||||
colors: const [Color(0xFF60A5FA), Color(0xFFC4B5FD)],
|
||||
),
|
||||
];
|
||||
|
||||
return _Panel(
|
||||
title: '功能入口',
|
||||
backgroundGradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [Color(0xFAFFFFFF), Color(0xF5EFF6FF)],
|
||||
),
|
||||
return _LightSection(
|
||||
title: '常用功能',
|
||||
child: GridView.builder(
|
||||
itemCount: items.length,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
mainAxisExtent: 98,
|
||||
mainAxisSpacing: 10,
|
||||
crossAxisSpacing: 10,
|
||||
crossAxisCount: 2,
|
||||
mainAxisExtent: 48,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
@@ -398,14 +396,14 @@ class _NavTile extends StatelessWidget {
|
||||
};
|
||||
|
||||
List<Color> get _colors => switch (item.route) {
|
||||
'healthArchive' => const [Color(0xFF93C5FD), Color(0xFF60A5FA)],
|
||||
'reports' => const [Color(0xFF60A5FA), Color(0xFF2563EB)],
|
||||
'medications' => const [Color(0xFFA78BFA), Color(0xFF7C3AED)],
|
||||
'dietRecords' => const [Color(0xFFFBCFE8), Color(0xFFF472B6)],
|
||||
'calendar' => const [Color(0xFFC4B5FD), Color(0xFF8B5CF6)],
|
||||
'followups' => const [Color(0xFFF472B6), Color(0xFFDB2777)],
|
||||
'exercisePlan' => const [Color(0xFF7DD3FC), Color(0xFF60A5FA)],
|
||||
'devices' => const [Color(0xFF60A5FA), Color(0xFFC4B5FD)],
|
||||
'healthArchive' => const [AppColors.healthLight, AppColors.health],
|
||||
'reports' => const [AppColors.reportLight, AppColors.report],
|
||||
'medications' => const [AppColors.medicationLight, AppColors.medication],
|
||||
'dietRecords' => const [AppColors.dietLight, AppColors.diet],
|
||||
'calendar' => const [AppColors.calendarLight, AppColors.calendar],
|
||||
'followups' => const [AppColors.followupLight, AppColors.followup],
|
||||
'exercisePlan' => const [AppColors.exerciseLight, AppColors.exercise],
|
||||
'devices' => const [AppColors.deviceLight, AppColors.device],
|
||||
_ => item.colors,
|
||||
};
|
||||
|
||||
@@ -413,39 +411,39 @@ class _NavTile extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: AppRadius.mdBorder,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: AppColors.borderLight, width: 1.1),
|
||||
boxShadow: AppColors.cardShadowLight,
|
||||
color: Colors.white.withValues(alpha: 0.54),
|
||||
borderRadius: AppRadius.mdBorder,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: _colors,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderRadius: AppRadius.smBorder,
|
||||
),
|
||||
child: Icon(item.icon, color: Colors.white, size: 24),
|
||||
child: Icon(item.icon, color: Colors.white, size: 19),
|
||||
),
|
||||
const SizedBox(height: 9),
|
||||
Text(
|
||||
_title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: AppColors.textPrimary,
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
_title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -455,6 +453,39 @@ class _NavTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _LightSection extends StatelessWidget {
|
||||
final String title;
|
||||
final Widget child;
|
||||
|
||||
const _LightSection({required this.title, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
child,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
class _Panel extends StatelessWidget {
|
||||
final String title;
|
||||
final Widget child;
|
||||
@@ -484,18 +515,12 @@ class _Panel extends StatelessWidget {
|
||||
const Color(0xFFF8F4FF).withValues(alpha: 0.84),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
borderRadius: AppRadius.xlBorder,
|
||||
border: Border.all(
|
||||
color: Colors.white.withValues(alpha: 0.82),
|
||||
width: 1.2,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF6D5DF6).withValues(alpha: 0.08),
|
||||
blurRadius: 22,
|
||||
offset: const Offset(0, 12),
|
||||
),
|
||||
],
|
||||
boxShadow: AppShadows.soft,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -611,8 +636,6 @@ class _NavItem {
|
||||
required this.colors,
|
||||
});
|
||||
}
|
||||
|
||||
/// 侧边栏底部:最近 5 条对话历史 + 查看全部 + 清空。
|
||||
class _HistorySection extends ConsumerWidget {
|
||||
final WidgetRef ref;
|
||||
const _HistorySection({required this.ref});
|
||||
@@ -668,7 +691,7 @@ class _HistorySection extends ConsumerWidget {
|
||||
item: preview[i],
|
||||
isLast: i == preview.length - 1,
|
||||
onTap: () async {
|
||||
Navigator.of(context).maybePop(); // 关侧边栏
|
||||
Navigator.of(context).maybePop(); // 关闭侧边栏
|
||||
await ref
|
||||
.read(chatProvider.notifier)
|
||||
.loadConversation(preview[i].id);
|
||||
@@ -779,11 +802,10 @@ class _HistoryActions extends StatelessWidget {
|
||||
await ref.read(conversationHistoryProvider.notifier).clearAll();
|
||||
} catch (_) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('清空失败,请稍后重试'),
|
||||
backgroundColor: AppColors.error,
|
||||
),
|
||||
AppToast.show(
|
||||
context,
|
||||
'清空失败,请稍后重试',
|
||||
type: AppToastType.error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user