Files
kuaishai2/lib/features/programs/models/step.dart
Developer d53c41c300 feat(device): 添加USB设备通信支持和程序参数优化
- 在AndroidManifest.xml中添加USB Host权限和设备过滤器配置
- 新增设备控制国际化词条包括速度档位、吹气时间等
- 重构数据库结构将速度相关字段统一为档位数值存储
- 添加通用KV存储方法用于settings表数据读写
- 优化首页导航实现tab间跳转和状态保持功能
- 更新程序详情页面布局和参数表单界面
- 移除模拟运行器相关测试代码
- 添加USB串口通信依赖包usb_serial
2026-06-04 15:13:36 +08:00

83 lines
1.9 KiB
Dart

/// 步骤模型
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 int blowTime;
final int speed;
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.blowTime = 0,
this.speed = 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,
'blow_time': blowTime,
'speed': speed,
};
}
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,
blowTime: map['blow_time'] as int? ?? 0,
speed: map['speed'] as int? ?? 5,
);
}
Step copyWith({
int? id,
int? programId,
int? stepNo,
String? position,
String? name,
int? mixTime,
int? magnetTime,
int? volume,
int? blowTime,
int? speed,
}) {
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,
blowTime: blowTime ?? this.blowTime,
speed: speed ?? this.speed,
);
}
}