Initial commit: 健康管家 AI 健康陪伴助手

- Backend: .NET 10 Minimal API + EF Core + PostgreSQL
- Frontend: Flutter + Riverpod + GoRouter + Dio
- AI: DeepSeek LLM + Qwen VLM (OpenAI-compatible)
- Auth: SMS + JWT (access/refresh tokens)
- Features: AI chat, health tracking, medication management, diet analysis, exercise plans, doctor consultations, report analysis
This commit is contained in:
MingNian
2026-06-02 11:11:29 +08:00
commit 14d7c30d3d
144 changed files with 11436 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:health_app/core/app_theme.dart';
import 'package:health_app/pages/auth/login_page.dart';
import 'package:health_app/widgets/agent_bar.dart';
void main() {
testWidgets('主题颜色正确', (tester) async {
expect(AppTheme.primaryColor, const Color(0xFF635BFF));
expect(AppTheme.background, const Color(0xFFF8F9FF));
expect(AppTheme.errorRed, const Color(0xFFE53935));
expect(AppTheme.successGreen, const Color(0xFF43A047));
});
testWidgets('登录页渲染正常', (tester) async {
await tester.pumpWidget(const ProviderScope(child: MaterialApp(home: LoginPage())));
await tester.pumpAndSettle();
expect(find.text('健康管家'), findsOneWidget);
expect(find.text('登 录'), findsOneWidget);
});
testWidgets('获取验证码按钮存在', (tester) async {
await tester.pumpWidget(const ProviderScope(child: MaterialApp(home: LoginPage())));
await tester.pumpAndSettle();
expect(find.text('获取验证码'), findsOneWidget);
});
testWidgets('智能体胶囊栏渲染 6 个胶囊', (tester) async {
await tester.pumpWidget(const ProviderScope(child: MaterialApp(home: Scaffold(body: AgentBar()))));
await tester.pumpAndSettle();
expect(find.text('AI问诊'), findsOneWidget);
expect(find.text('记数据'), findsOneWidget);
expect(find.text('拍饮食'), findsOneWidget);
expect(find.text('药管家'), findsOneWidget);
expect(find.text('看报告'), findsOneWidget);
expect(find.text('运动计划'), findsOneWidget);
});
testWidgets('AI 气泡样式', (tester) async {
await tester.pumpWidget(MaterialApp(
theme: AppTheme.lightTheme,
home: Scaffold(body: Align(
alignment: Alignment.centerLeft,
child: Container(
constraints: const BoxConstraints(maxWidth: 300),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
border: const Border(left: BorderSide(color: Color(0xFF635BFF), width: 3)),
),
child: const Text('收到!已记录', style: TextStyle(fontSize: 16)),
),
)),
));
await tester.pumpAndSettle();
expect(find.text('收到!已记录'), findsOneWidget);
});
testWidgets('用户气泡样式', (tester) async {
await tester.pumpWidget(MaterialApp(
theme: AppTheme.lightTheme,
home: Scaffold(body: Align(
alignment: Alignment.centerRight,
child: Container(
constraints: const BoxConstraints(maxWidth: 300),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFF635BFF),
borderRadius: BorderRadius.circular(16),
),
child: const Text('血压 135/85', style: TextStyle(fontSize: 16, color: Colors.white)),
),
)),
));
await tester.pumpAndSettle();
expect(find.text('血压 135/85'), findsOneWidget);
});
}