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,78 @@
|
||||
import '../diagnostics/app_diagnostics.dart';
|
||||
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
import '../persistence/settings/view_settings_repositories.dart';
|
||||
import '../settings/settings_write_queue.dart';
|
||||
import 'workspace_mode.dart';
|
||||
|
||||
part 'view_settings.g.dart';
|
||||
|
||||
/// Persistent navigation preferences, shared by the application surface.
|
||||
@Riverpod(keepAlive: true)
|
||||
class WorkspaceViewSettings extends _$WorkspaceViewSettings {
|
||||
final _writes = SettingsWriteQueue();
|
||||
|
||||
@override
|
||||
Future<WorkspaceViewSettingsData> build() async {
|
||||
try {
|
||||
return await ref.watch(workspaceViewSettingsRepositoryProvider).load();
|
||||
} catch (error, stackTrace) {
|
||||
AppDiagnostics.failure(
|
||||
'settings',
|
||||
'loadWorkspaceView',
|
||||
error,
|
||||
stackTrace,
|
||||
);
|
||||
return const WorkspaceViewSettingsData();
|
||||
}
|
||||
}
|
||||
|
||||
void setMode(WorkspaceMode mode) =>
|
||||
state = AsyncData(state.requireValue.copyWith(mode: mode));
|
||||
|
||||
void setSidebarCollapsed(bool collapsed) => state = AsyncData(
|
||||
state.requireValue.copyWith(sidebarCollapsed: collapsed),
|
||||
);
|
||||
|
||||
void setSidebarWidth(double? width) =>
|
||||
state = AsyncData(state.requireValue.copyWith(sidebarWidth: width));
|
||||
|
||||
/// Writes snapshots in order so a slower drag save cannot replace a newer one.
|
||||
Future<void> save({required String? activeProjectId}) {
|
||||
final value = state.requireValue.copyWith(activeProjectId: activeProjectId);
|
||||
state = AsyncData(value);
|
||||
final repository = ref.read(workspaceViewSettingsRepositoryProvider);
|
||||
return _writes.run(() => repository.save(value));
|
||||
}
|
||||
}
|
||||
|
||||
/// Project preferences survive timeline switches and widget reconstruction.
|
||||
@Riverpod(keepAlive: true)
|
||||
class ProjectViewSettings extends _$ProjectViewSettings {
|
||||
final _writes = SettingsWriteQueue();
|
||||
|
||||
@override
|
||||
Future<ProjectViewSettingsData> build(String projectId) async {
|
||||
try {
|
||||
return await ref
|
||||
.watch(projectViewSettingsRepositoryProvider)
|
||||
.load(projectId);
|
||||
} catch (error, stackTrace) {
|
||||
AppDiagnostics.failure('settings', 'loadProjectView', error, stackTrace);
|
||||
return const ProjectViewSettingsData();
|
||||
}
|
||||
}
|
||||
|
||||
void setPropertiesOpen(bool open) =>
|
||||
state = AsyncData(state.requireValue.copyWith(propertiesOpen: open));
|
||||
|
||||
void setTimelineHeight(double? height) =>
|
||||
state = AsyncData(state.requireValue.copyWith(timelineHeight: height));
|
||||
|
||||
Future<void> save() {
|
||||
final value = state.requireValue;
|
||||
final repository = ref.read(projectViewSettingsRepositoryProvider);
|
||||
return _writes.run(() => repository.save(projectId, value));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user