feat: initial Cutdex application
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.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../workspace/timeline_provider.dart';
|
||||
import '../../workspace/timeline_session.dart';
|
||||
import 'properties_presentation_state.dart';
|
||||
|
||||
final propertiesInspectorProvider = Provider.autoDispose
|
||||
.family<PropertiesInspectorController?, (String, String)>((ref, identity) {
|
||||
final session = ref
|
||||
.watch(editorTimelineProvider(identity.$1, identity.$2))
|
||||
.value;
|
||||
if (session == null) return null;
|
||||
final controller = PropertiesInspectorController(session);
|
||||
ref.onDispose(controller.dispose);
|
||||
return controller;
|
||||
});
|
||||
|
||||
/// Resolves the shared editing selection without prescribing a device layout.
|
||||
class PropertiesInspectorController extends ChangeNotifier {
|
||||
PropertiesInspectorController(this.session) {
|
||||
session.addListener(_sessionChanged);
|
||||
_bindView();
|
||||
}
|
||||
final EditorTimelineSession session;
|
||||
Listenable? _editingChanges;
|
||||
SequenceId? get sequence => session.activeSequenceId;
|
||||
|
||||
void _bindView() {
|
||||
final id = sequence;
|
||||
final next = id == null ? null : session.view(id).editingChanges;
|
||||
if (identical(next, _editingChanges)) return;
|
||||
_editingChanges?.removeListener(notifyListeners);
|
||||
_editingChanges = next;
|
||||
_editingChanges?.addListener(notifyListeners);
|
||||
}
|
||||
|
||||
void _sessionChanged() {
|
||||
_bindView();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
List<ElementRecord> get selectedClips {
|
||||
final id = sequence;
|
||||
if (id == null) return const [];
|
||||
final view = session.view(id);
|
||||
final query = view.version.kernelVersion.query();
|
||||
final handles = <ElementHandle>{};
|
||||
for (final identity in view.selectedIdentities) {
|
||||
final handle = switch (identity) {
|
||||
ElementHandle handle => handle,
|
||||
LayoutBodyId body => view.elementForIdentity(body),
|
||||
_ => null,
|
||||
};
|
||||
if (handle != null && query.ownerOf(handle) != null) handles.add(handle);
|
||||
}
|
||||
final clips = [for (final handle in handles) query.element(handle)];
|
||||
return clips.any((clip) => clip.structure != ElementStructure.gap)
|
||||
? clips
|
||||
: const [];
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
session.removeListener(_sessionChanged);
|
||||
_editingChanges?.removeListener(notifyListeners);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
List<PropertyCategory> categoriesForClip(ElementRecord clip, String? type) {
|
||||
if (clip.structure != ElementStructure.content) {
|
||||
return [PropertyCategory.basic];
|
||||
}
|
||||
return switch (type) {
|
||||
'video' => [
|
||||
PropertyCategory.picture,
|
||||
PropertyCategory.mask,
|
||||
PropertyCategory.audio,
|
||||
PropertyCategory.speed,
|
||||
PropertyCategory.animation,
|
||||
],
|
||||
'audio' => [PropertyCategory.audio, PropertyCategory.speed],
|
||||
'image' => [
|
||||
PropertyCategory.picture,
|
||||
PropertyCategory.mask,
|
||||
PropertyCategory.animation,
|
||||
],
|
||||
_ => [PropertyCategory.basic],
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user