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,58 @@
|
||||
import 'package:filegate/filegate.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
import '../../workspace/media_import.dart';
|
||||
|
||||
part 'file_picker.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
AppFilePicker filePicker(Ref ref) => const AppFilePicker();
|
||||
|
||||
class AppFilePicker {
|
||||
const AppFilePicker();
|
||||
|
||||
Future<String?> pickDirectory({
|
||||
String? initialDirectory,
|
||||
String? confirmButtonText,
|
||||
}) async {
|
||||
final entry = await const Filegate().pickDirectory(
|
||||
initialDirectory: initialDirectory,
|
||||
confirmButtonText: confirmButtonText,
|
||||
);
|
||||
return entry == null ? null : _localPath(entry);
|
||||
}
|
||||
|
||||
Future<List<ExternalMediaFile>> pickFiles({
|
||||
required List<String> allowedExtensions,
|
||||
}) async {
|
||||
final entries = await const Filegate().pickFiles(
|
||||
allowMultiple: true,
|
||||
allowedExtensions: allowedExtensions,
|
||||
persistAccess: false,
|
||||
);
|
||||
return [
|
||||
for (final entry in entries ?? <PickedEntry>[])
|
||||
if (entry.isContentUri)
|
||||
ExternalMediaFile.content(
|
||||
uri: entry.uri!,
|
||||
name: entry.name,
|
||||
byteLength: entry.size,
|
||||
)
|
||||
else
|
||||
ExternalMediaFile(path: _localPath(entry)),
|
||||
];
|
||||
}
|
||||
|
||||
String _localPath(PickedEntry entry) {
|
||||
final path = entry.fileSystemPath;
|
||||
if (path == null) {
|
||||
throw PlatformException(
|
||||
code: 'unsupported_location',
|
||||
message: 'Cutdex requires a local file system path.',
|
||||
details: entry.path,
|
||||
);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user