chore(project): 初始化项目基础配置文件
- 添加 CodeGraph、Android 和通用 gitignore 配置 - 创建项目元数据文件跟踪 Flutter 项目属性 - 添加 Codex AI 指导文档 AGENTS.md 说明项目架构 - 配置代码分析选项 analysis_options.yaml - 设置 Android 应用清单权限和 Kiosk 模式配置 - 实现中英文国际化支持 AppLocalizations - 配置 GoRouter 应用路由导航 - 创建明亮工业控制风格的主题配置 AppTheme
This commit is contained in:
52
lib/features/programs/models/program.dart
Normal file
52
lib/features/programs/models/program.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
/// 程序模型
|
||||
class Program {
|
||||
final int? id;
|
||||
final String code;
|
||||
final String name;
|
||||
final String createdAt;
|
||||
final int status; // 1: 启用, 0: 停用
|
||||
|
||||
Program({
|
||||
this.id,
|
||||
required this.code,
|
||||
required this.name,
|
||||
required this.createdAt,
|
||||
this.status = 1,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'code': code,
|
||||
'name': name,
|
||||
'created_at': createdAt,
|
||||
'status': status,
|
||||
};
|
||||
}
|
||||
|
||||
factory Program.fromMap(Map<String, dynamic> map) {
|
||||
return Program(
|
||||
id: map['id'] as int?,
|
||||
code: map['code'] as String,
|
||||
name: map['name'] as String,
|
||||
createdAt: map['created_at'] as String,
|
||||
status: map['status'] as int? ?? 1,
|
||||
);
|
||||
}
|
||||
|
||||
Program copyWith({
|
||||
int? id,
|
||||
String? code,
|
||||
String? name,
|
||||
String? createdAt,
|
||||
int? status,
|
||||
}) {
|
||||
return Program(
|
||||
id: id ?? this.id,
|
||||
code: code ?? this.code,
|
||||
name: name ?? this.name,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
status: status ?? this.status,
|
||||
);
|
||||
}
|
||||
}
|
||||
94
lib/features/programs/models/step.dart
Normal file
94
lib/features/programs/models/step.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
/// 步骤模型
|
||||
class Step {
|
||||
final int? id;
|
||||
final int programId;
|
||||
final int stepNo;
|
||||
final String position;
|
||||
final String name;
|
||||
final int mixTime;
|
||||
final int magnetTime;
|
||||
final int volume;
|
||||
final String mixSpeed;
|
||||
final String blowSpeed;
|
||||
final int blowTime;
|
||||
final int needleSpeed;
|
||||
|
||||
Step({
|
||||
this.id,
|
||||
required this.programId,
|
||||
required this.stepNo,
|
||||
required this.position,
|
||||
required this.name,
|
||||
this.mixTime = 0,
|
||||
this.magnetTime = 0,
|
||||
this.volume = 0,
|
||||
this.mixSpeed = '中速',
|
||||
this.blowSpeed = '中速',
|
||||
this.blowTime = 0,
|
||||
this.needleSpeed = 5,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'program_id': programId,
|
||||
'step_no': stepNo,
|
||||
'position': position,
|
||||
'name': name,
|
||||
'mix_time': mixTime,
|
||||
'magnet_time': magnetTime,
|
||||
'volume': volume,
|
||||
'mix_speed': mixSpeed,
|
||||
'blow_speed': blowSpeed,
|
||||
'blow_time': blowTime,
|
||||
'needle_speed': needleSpeed,
|
||||
};
|
||||
}
|
||||
|
||||
factory Step.fromMap(Map<String, dynamic> map) {
|
||||
return Step(
|
||||
id: map['id'] as int?,
|
||||
programId: map['program_id'] as int,
|
||||
stepNo: map['step_no'] as int,
|
||||
position: map['position'] as String,
|
||||
name: map['name'] as String,
|
||||
mixTime: map['mix_time'] as int? ?? 0,
|
||||
magnetTime: map['magnet_time'] as int? ?? 0,
|
||||
volume: map['volume'] as int? ?? 0,
|
||||
mixSpeed: map['mix_speed'] as String? ?? '中速',
|
||||
blowSpeed: map['blow_speed'] as String? ?? '中速',
|
||||
blowTime: map['blow_time'] as int? ?? 0,
|
||||
needleSpeed: map['needle_speed'] as int? ?? 5,
|
||||
);
|
||||
}
|
||||
|
||||
Step copyWith({
|
||||
int? id,
|
||||
int? programId,
|
||||
int? stepNo,
|
||||
String? position,
|
||||
String? name,
|
||||
int? mixTime,
|
||||
int? magnetTime,
|
||||
int? volume,
|
||||
String? mixSpeed,
|
||||
String? blowSpeed,
|
||||
int? blowTime,
|
||||
int? needleSpeed,
|
||||
}) {
|
||||
return Step(
|
||||
id: id ?? this.id,
|
||||
programId: programId ?? this.programId,
|
||||
stepNo: stepNo ?? this.stepNo,
|
||||
position: position ?? this.position,
|
||||
name: name ?? this.name,
|
||||
mixTime: mixTime ?? this.mixTime,
|
||||
magnetTime: magnetTime ?? this.magnetTime,
|
||||
volume: volume ?? this.volume,
|
||||
mixSpeed: mixSpeed ?? this.mixSpeed,
|
||||
blowSpeed: blowSpeed ?? this.blowSpeed,
|
||||
blowTime: blowTime ?? this.blowTime,
|
||||
needleSpeed: needleSpeed ?? this.needleSpeed,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user