upgrade deps

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-20 16:49:14 +08:00
parent 7c342032de
commit be5889ee33
5 changed files with 64 additions and 66 deletions

View File

@@ -117,27 +117,25 @@ Future<void> importFromClipBoard<T>(
Future<void> importFromLocalFile<T>({ Future<void> importFromLocalFile<T>({
required FutureOr<void> Function(T json) onImport, required FutureOr<void> Function(T json) onImport,
}) async { }) async {
final result = await FilePicker.pickFiles( final result = await FilePicker.pickFile(
type: .custom, type: .custom,
allowedExtensions: const ['json', 'txt'], allowedExtensions: const ['json', 'txt'],
); );
if (result != null) { if (result != null) {
final path = result.files.first.path; final path = result.xFile.path;
if (path != null) { final data = await File(path).readAsString();
final data = await File(path).readAsString(); final T json;
final T json; try {
try { json = jsonDecode(data);
json = jsonDecode(data); } catch (e) {
} catch (e) { SmartDialog.showToast('解析json失败$e');
SmartDialog.showToast('解析json失败$e'); return;
return; }
} try {
try { await onImport(json);
await onImport(json); SmartDialog.showToast('导入成功');
SmartDialog.showToast('导入成功'); } catch (e) {
} catch (e) { SmartDialog.showToast('导入失败:$e');
SmartDialog.showToast('导入失败:$e');
}
} }
} }
} }

View File

@@ -668,51 +668,49 @@ class HeaderControlState extends State<HeaderControl>
onTap: () async { onTap: () async {
Get.back(); Get.back();
try { try {
final result = await FilePicker.pickFiles( final result = await FilePicker.pickFile(
type: .custom, type: .custom,
allowedExtensions: const ['json', 'vtt', 'srt', 'ass'], allowedExtensions: const ['json', 'vtt', 'srt', 'ass'],
); );
if (result != null) { if (result != null) {
final file = result.files.single; final file = result.xFile;
final path = file.path; final path = file.path;
if (path != null) { final name = file.name;
final name = file.name; final length = videoDetailCtr.subtitles.length;
final length = videoDetailCtr.subtitles.length; if (name.endsWith('.json')) {
if (name.endsWith('.json')) { final file = File(path);
final file = File(path); final stream = file.openRead().transform(
final stream = file.openRead().transform( utf8.decoder,
utf8.decoder, );
); final buffer = StringBuffer();
final buffer = StringBuffer(); await for (final chunk in stream) {
await for (final chunk in stream) { if (!mounted) return;
if (!mounted) return; buffer.write(chunk);
buffer.write(chunk); }
} if (!mounted) return;
if (!mounted) return; String sub = buffer.toString();
String sub = buffer.toString(); sub = await compute<List, String>(
sub = await compute<List, String>( VideoHttp.processList,
VideoHttp.processList, jsonDecode(sub)['body'],
jsonDecode(sub)['body'], );
); if (!mounted) return;
if (!mounted) return; videoDetailCtr.vttSubtitles[length] = (
videoDetailCtr.vttSubtitles[length] = ( isData: true,
isData: true, id: sub,
id: sub, );
); } else {
} else { videoDetailCtr.vttSubtitles[length] = (
videoDetailCtr.vttSubtitles[length] = ( isData: false,
isData: false, id: path,
id: path,
);
}
videoDetailCtr.subtitles.add(
Subtitle(
lan: '',
lanDoc: name.split('.').firstOrNull ?? name,
),
); );
await videoDetailCtr.setSubtitle(length + 1);
} }
videoDetailCtr.subtitles.add(
Subtitle(
lan: '',
lanDoc: name.split('.').firstOrNull ?? name,
),
);
await videoDetailCtr.setSubtitle(length + 1);
} }
} catch (e) { } catch (e) {
SmartDialog.showToast('加载失败: $e'); SmartDialog.showToast('加载失败: $e');

View File

@@ -316,6 +316,7 @@ abstract final class ImageUtils {
final savePath = await FilePicker.saveFile( final savePath = await FilePicker.saveFile(
type: FileType.image, type: FileType.image,
fileName: fileName, fileName: fileName,
bytes: Uint8List(0),
); );
if (savePath == null) { if (savePath == null) {
SmartDialog.showToast("取消保存"); SmartDialog.showToast("取消保存");
@@ -353,6 +354,7 @@ abstract final class ImageUtils {
final savePath = await FilePicker.saveFile( final savePath = await FilePicker.saveFile(
type: type, type: type,
fileName: fileName, fileName: fileName,
bytes: Uint8List(0),
); );
if (savePath == null) { if (savePath == null) {
SmartDialog.showToast("取消保存"); SmartDialog.showToast("取消保存");

View File

@@ -17,7 +17,7 @@ abstract final class StorageUtils {
allowedExtensions: allowedExtensions, allowedExtensions: allowedExtensions,
type: type, type: type,
fileName: name, fileName: name,
bytes: PlatformUtils.isDesktop ? null : bytes, bytes: PlatformUtils.isDesktop ? Uint8List(0) : bytes,
); );
if (path == null) { if (path == null) {
SmartDialog.showToast("取消保存"); SmartDialog.showToast("取消保存");

View File

@@ -522,10 +522,10 @@ packages:
description: description:
path: "." path: "."
ref: dev ref: dev
resolved-ref: "8cf6cfa7078aa69c2c7b08d9ad636a1040456852" resolved-ref: c4672374956fa28d117ef7a55a6e708daddbf462
url: "https://github.com/bggRGjQaUbCoE/flutter_file_picker.git" url: "https://github.com/bggRGjQaUbCoE/flutter_file_picker.git"
source: git source: git
version: "12.0.0-beta.3" version: "12.0.0-beta.4"
file_selector_linux: file_selector_linux:
dependency: transitive dependency: transitive
description: description:
@@ -1150,7 +1150,7 @@ packages:
description: description:
path: media_kit path: media_kit
ref: "version_1.2.5" ref: "version_1.2.5"
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136" resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
url: "https://github.com/My-Responsitories/media-kit.git" url: "https://github.com/My-Responsitories/media-kit.git"
source: git source: git
version: "1.1.11" version: "1.1.11"
@@ -1159,7 +1159,7 @@ packages:
description: description:
path: "libs/android/media_kit_libs_android_video" path: "libs/android/media_kit_libs_android_video"
ref: "version_1.2.5" ref: "version_1.2.5"
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136" resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
url: "https://github.com/My-Responsitories/media-kit.git" url: "https://github.com/My-Responsitories/media-kit.git"
source: git source: git
version: "1.3.7" version: "1.3.7"
@@ -1193,7 +1193,7 @@ packages:
description: description:
path: "libs/universal/media_kit_libs_video" path: "libs/universal/media_kit_libs_video"
ref: "version_1.2.5" ref: "version_1.2.5"
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136" resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
url: "https://github.com/My-Responsitories/media-kit.git" url: "https://github.com/My-Responsitories/media-kit.git"
source: git source: git
version: "1.0.5" version: "1.0.5"
@@ -1202,7 +1202,7 @@ packages:
description: description:
path: "libs/windows/media_kit_libs_windows_video" path: "libs/windows/media_kit_libs_windows_video"
ref: "version_1.2.5" ref: "version_1.2.5"
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136" resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
url: "https://github.com/My-Responsitories/media-kit.git" url: "https://github.com/My-Responsitories/media-kit.git"
source: git source: git
version: "1.0.10" version: "1.0.10"
@@ -1211,7 +1211,7 @@ packages:
description: description:
path: media_kit_native_event_loop path: media_kit_native_event_loop
ref: "version_1.2.5" ref: "version_1.2.5"
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136" resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
url: "https://github.com/My-Responsitories/media-kit.git" url: "https://github.com/My-Responsitories/media-kit.git"
source: git source: git
version: "1.0.9" version: "1.0.9"
@@ -1220,7 +1220,7 @@ packages:
description: description:
path: media_kit_video path: media_kit_video
ref: "version_1.2.5" ref: "version_1.2.5"
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136" resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
url: "https://github.com/My-Responsitories/media-kit.git" url: "https://github.com/My-Responsitories/media-kit.git"
source: git source: git
version: "1.2.5" version: "1.2.5"
@@ -1867,10 +1867,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_android name: url_launcher_android
sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572" sha256: "17bc677f0b301615530dd1d67e0a9828cafa2d0b6b6eae4cd3679b7eac4a273c"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.3.29" version: "6.3.30"
url_launcher_ios: url_launcher_ios:
dependency: transitive dependency: transitive
description: description: