Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
33 lines
930 B
Dart
33 lines
930 B
Dart
import '../../workspace/project_state.dart';
|
|
import 'composer_document.dart';
|
|
|
|
/// Checks draft references against the project currently open in the composer.
|
|
final class ComposerReferenceValidator {
|
|
const ComposerReferenceValidator({
|
|
required this.workspace,
|
|
required this.projectId,
|
|
});
|
|
|
|
final ProjectState? workspace;
|
|
final String? projectId;
|
|
|
|
bool isValid(ComposerReference reference) {
|
|
if (projectId != reference.projectId ||
|
|
workspace?.activeProject?.id != reference.projectId) {
|
|
return false;
|
|
}
|
|
return switch (reference.kind) {
|
|
ComposerReferenceKind.media => workspace!.assets.any(
|
|
(asset) => asset.id == reference.id,
|
|
),
|
|
ComposerReferenceKind.timeline => workspace!.timelines.any(
|
|
(timeline) => timeline.id == reference.id,
|
|
),
|
|
};
|
|
}
|
|
|
|
void validate(ComposerDocumentController document) {
|
|
document.updateValidity(isValid);
|
|
}
|
|
}
|