- 日期/时间/次数选择器统一改为底部弹出Cupertino滚轮,无单位标签,双横线选区 - App更名为"小脉健康",副标题"血管病患者的AI健康管理助手" - 健康仪表盘及侧边栏移除体重指标,侧边栏背景改为蓝白渐变 - 健康档案按钮移入功能入口网格,与其他入口样式统一 - 记数据智能体配色改为绿色渐变(#A1FFCE→#69DB8F) - 隐私协议/关于页从Text改为MarkdownBody正确渲染 - 运动计划/饮食记录卡片添加边框和阴影 - 服药次数从chip改为滚轮选择器 - 日期显示格式统一为空格分隔(1999 01 01) - 健康档案页背景改为纯白
72 lines
2.5 KiB
Dart
72 lines
2.5 KiB
Dart
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';
|
|
|
|
void main() {
|
|
testWidgets('主题颜色正确', (tester) async {
|
|
expect(AppTheme.primary, const Color(0xFF6366F1));
|
|
expect(AppTheme.primaryLight, const Color(0xFFEEF2FF));
|
|
expect(AppTheme.bg, AppTheme.bg);
|
|
expect(AppTheme.error, const Color(0xFFF56C6C));
|
|
expect(AppTheme.success, const Color(0xFF6ECF8A));
|
|
});
|
|
|
|
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('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: AppTheme.primaryLight, 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: AppTheme.primaryLight,
|
|
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);
|
|
});
|
|
}
|