- 新增 Flutter 跨平台客户端项目 (clients/flutter/)
- 29 个 Dart 文件: 服务层/状态管理/5个页面/BLE配网
- BLE 蓝牙配网: 扫描设备、写入WiFi凭据、配网状态监听
- HTTP API 客户端: 覆盖全部端点 (播放/场景/WiFi/视频/配置/文件/插件)
- WebSocket 实时通信: 事件流 + 自动重连
- 暗色主题 Material 3 UI, 中文界面
- Android 配置: minSdkVersion 21, BLE/网络权限
- PRD 产品需求文档 + 开发任务看板
- Web UI 添加 APK 下载入口 (routes.rs)
- 下载弹窗 + 二维码 + /download/{filename} 静态文件路由
- BLE 插件增加自动重连循环 (ble/mod.rs)
- BLE 默认设备名修正为 'Showen' (config.rs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
1.8 KiB
Dart
69 lines
1.8 KiB
Dart
class PlayerStatus {
|
|
const PlayerStatus({
|
|
required this.running,
|
|
required this.paused,
|
|
required this.inTransition,
|
|
required this.currentIndex,
|
|
required this.playlistLength,
|
|
this.currentVideo,
|
|
});
|
|
|
|
final bool running;
|
|
final bool paused;
|
|
final bool inTransition;
|
|
final int currentIndex;
|
|
final int playlistLength;
|
|
final String? currentVideo;
|
|
|
|
factory PlayerStatus.initial() {
|
|
return const PlayerStatus(
|
|
running: false,
|
|
paused: false,
|
|
inTransition: false,
|
|
currentIndex: 0,
|
|
playlistLength: 0,
|
|
currentVideo: null,
|
|
);
|
|
}
|
|
|
|
factory PlayerStatus.fromJson(Map<String, dynamic> json) {
|
|
return PlayerStatus(
|
|
running: json['running'] as bool? ?? false,
|
|
paused: json['paused'] as bool? ?? false,
|
|
inTransition: json['in_transition'] as bool? ?? false,
|
|
currentIndex: json['current_index'] as int? ?? 0,
|
|
playlistLength: json['playlist_length'] as int? ?? 0,
|
|
currentVideo: json['current_video'] as String?,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return <String, dynamic>{
|
|
'running': running,
|
|
'paused': paused,
|
|
'in_transition': inTransition,
|
|
'current_index': currentIndex,
|
|
'playlist_length': playlistLength,
|
|
'current_video': currentVideo,
|
|
};
|
|
}
|
|
|
|
PlayerStatus copyWith({
|
|
bool? running,
|
|
bool? paused,
|
|
bool? inTransition,
|
|
int? currentIndex,
|
|
int? playlistLength,
|
|
String? currentVideo,
|
|
}) {
|
|
return PlayerStatus(
|
|
running: running ?? this.running,
|
|
paused: paused ?? this.paused,
|
|
inTransition: inTransition ?? this.inTransition,
|
|
currentIndex: currentIndex ?? this.currentIndex,
|
|
playlistLength: playlistLength ?? this.playlistLength,
|
|
currentVideo: currentVideo ?? this.currentVideo,
|
|
);
|
|
}
|
|
}
|