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,61 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
import '../persistence/app_settings_repositories.dart';
|
||||
import 'projects.dart';
|
||||
import 'timeline_session.dart';
|
||||
import 'timeline_view_state.dart';
|
||||
|
||||
part 'timeline_provider.g.dart';
|
||||
|
||||
@riverpod
|
||||
FutureOr<EditorTimelineSession> editorTimeline(
|
||||
Ref ref,
|
||||
String projectId,
|
||||
String timelineId,
|
||||
) {
|
||||
final ids = (projectId, timelineId);
|
||||
|
||||
final projects = ref.read(projectsProvider.notifier);
|
||||
final cached = projects.cachedTimelineSession(projectId, timelineId);
|
||||
if (cached != null) return _bindTimeline(ref, ids, cached);
|
||||
return projects.openTimelineSession(projectId, timelineId).then((session) {
|
||||
if (!ref.mounted) return session;
|
||||
return _bindTimeline(ref, ids, session);
|
||||
});
|
||||
}
|
||||
|
||||
FutureOr<EditorTimelineSession> _bindTimeline(
|
||||
Ref ref,
|
||||
(String, String) ids,
|
||||
EditorTimelineSession session,
|
||||
) {
|
||||
final binding = TimelineViewStateBinding.attach(
|
||||
projectId: ids.$1,
|
||||
timelineId: ids.$2,
|
||||
session: session,
|
||||
repository: ref.read(timelineViewSettingsRepositoryProvider),
|
||||
);
|
||||
if (binding is TimelineViewStateBinding) {
|
||||
return _retainTimeline(ref, session, binding);
|
||||
}
|
||||
return binding.then((resolved) => _retainTimeline(ref, session, resolved));
|
||||
}
|
||||
|
||||
EditorTimelineSession _retainTimeline(
|
||||
Ref ref,
|
||||
EditorTimelineSession session,
|
||||
TimelineViewStateBinding binding,
|
||||
) {
|
||||
if (ref.mounted) {
|
||||
final releaseViews = session.retainViews();
|
||||
ref.onDispose(() {
|
||||
unawaited(binding.close());
|
||||
releaseViews();
|
||||
});
|
||||
} else {
|
||||
unawaited(binding.close());
|
||||
}
|
||||
return session;
|
||||
}
|
||||
Reference in new issue
Block a user