chore(project): 初始化项目基础配置文件

- 添加 CodeGraph、Android 和通用 gitignore 配置
- 创建项目元数据文件跟踪 Flutter 项目属性
- 添加 Codex AI 指导文档 AGENTS.md 说明项目架构
- 配置代码分析选项 analysis_options.yaml
- 设置 Android 应用清单权限和 Kiosk 模式配置
- 实现中英文国际化支持 AppLocalizations
- 配置 GoRouter 应用路由导航
- 创建明亮工业控制风格的主题配置 AppTheme
This commit is contained in:
Developer
2026-06-04 11:19:44 +08:00
commit 5d28bf631b
85 changed files with 21423 additions and 0 deletions

91
test/models_test.dart Normal file
View File

@@ -0,0 +1,91 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:kuaishai2/features/programs/models/program.dart';
import 'package:kuaishai2/features/programs/models/step.dart';
void main() {
group('Program Model', () {
test('toMap and fromMap should work correctly', () {
final program = Program(
id: 1,
code: 'P001',
name: 'Test Program',
createdAt: '2026-05-20',
status: 1,
);
final map = program.toMap();
final fromMap = Program.fromMap(map);
expect(fromMap.id, equals(program.id));
expect(fromMap.code, equals(program.code));
expect(fromMap.name, equals(program.name));
expect(fromMap.createdAt, equals(program.createdAt));
expect(fromMap.status, equals(program.status));
});
test('copyWith should create modified copy', () {
final program = Program(
id: 1,
code: 'P001',
name: 'Test Program',
createdAt: '2026-05-20',
status: 1,
);
final copy = program.copyWith(name: 'Updated Name', status: 0);
expect(copy.id, equals(program.id));
expect(copy.code, equals(program.code));
expect(copy.name, equals('Updated Name'));
expect(copy.status, equals(0));
});
});
group('Step Model', () {
test('toMap and fromMap should work correctly', () {
final step = Step(
id: 1,
programId: 1,
stepNo: 1,
position: 'A1',
name: 'Mix',
mixTime: 60,
magnetTime: 30,
volume: 100,
mixSpeed: '中速',
blowSpeed: '高速',
blowTime: 10,
needleSpeed: 5,
);
final map = step.toMap();
final fromMap = Step.fromMap(map);
expect(fromMap.id, equals(step.id));
expect(fromMap.programId, equals(step.programId));
expect(fromMap.stepNo, equals(step.stepNo));
expect(fromMap.position, equals(step.position));
expect(fromMap.name, equals(step.name));
expect(fromMap.mixTime, equals(step.mixTime));
expect(fromMap.magnetTime, equals(step.magnetTime));
expect(fromMap.volume, equals(step.volume));
});
test('copyWith should create modified copy', () {
final step = Step(
id: 1,
programId: 1,
stepNo: 1,
position: 'A1',
name: 'Mix',
mixTime: 60,
);
final copy = step.copyWith(stepNo: 2, mixTime: 120);
expect(copy.id, equals(step.id));
expect(copy.stepNo, equals(2));
expect(copy.mixTime, equals(120));
});
});
}