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

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