Flutter web app replacing legacy WPF CCTV surveillance keyboard controller. Includes wall overview, section view with monitor grid, camera input, PTZ control, alarm/lock/sequence BLoCs, and legacy-matching UI styling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.6 KiB
Dart
56 lines
1.6 KiB
Dart
import '../../../domain/entities/sequence.dart';
|
|
|
|
class SequenceState {
|
|
final List<SequenceDefinition> sequences;
|
|
final List<SequenceCategory> categories;
|
|
final Map<int, RunningSequence> running; // viewerId -> RunningSequence
|
|
final int? selectedCategoryId;
|
|
final bool isLoading;
|
|
final String? error;
|
|
|
|
const SequenceState({
|
|
this.sequences = const [],
|
|
this.categories = const [],
|
|
this.running = const {},
|
|
this.selectedCategoryId,
|
|
this.isLoading = false,
|
|
this.error,
|
|
});
|
|
|
|
/// Sequences filtered by selected category
|
|
List<SequenceDefinition> get filteredSequences {
|
|
if (selectedCategoryId == null) return sequences;
|
|
return sequences
|
|
.where((s) => s.categoryId == selectedCategoryId)
|
|
.toList();
|
|
}
|
|
|
|
/// Check if a sequence is running on a viewer
|
|
bool isRunningOnViewer(int viewerId) => running.containsKey(viewerId);
|
|
|
|
/// Get running sequence for a viewer
|
|
RunningSequence? getRunning(int viewerId) => running[viewerId];
|
|
|
|
SequenceState copyWith({
|
|
List<SequenceDefinition>? sequences,
|
|
List<SequenceCategory>? categories,
|
|
Map<int, RunningSequence>? running,
|
|
int? selectedCategoryId,
|
|
bool clearCategory = false,
|
|
bool? isLoading,
|
|
String? error,
|
|
bool clearError = false,
|
|
}) {
|
|
return SequenceState(
|
|
sequences: sequences ?? this.sequences,
|
|
categories: categories ?? this.categories,
|
|
running: running ?? this.running,
|
|
selectedCategoryId: clearCategory
|
|
? null
|
|
: (selectedCategoryId ?? this.selectedCategoryId),
|
|
isLoading: isLoading ?? this.isLoading,
|
|
error: clearError ? null : (error ?? this.error),
|
|
);
|
|
}
|
|
}
|