mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-09 20:45:00 +08:00
Compare commits
7 Commits
2a3788ccdf
...
c94885a5c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c94885a5c4 | ||
|
|
99a950b049 | ||
|
|
87914a267a | ||
|
|
dd85aba8a9 | ||
|
|
8309be9ca9 | ||
|
|
5fbc86afa3 | ||
|
|
be5889ee33 |
@@ -117,27 +117,25 @@ Future<void> importFromClipBoard<T>(
|
||||
Future<void> importFromLocalFile<T>({
|
||||
required FutureOr<void> Function(T json) onImport,
|
||||
}) async {
|
||||
final result = await FilePicker.pickFiles(
|
||||
final result = await FilePicker.pickFile(
|
||||
type: .custom,
|
||||
allowedExtensions: const ['json', 'txt'],
|
||||
);
|
||||
if (result != null) {
|
||||
final path = result.files.first.path;
|
||||
if (path != null) {
|
||||
final data = await File(path).readAsString();
|
||||
final T json;
|
||||
try {
|
||||
json = jsonDecode(data);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('解析json失败:$e');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await onImport(json);
|
||||
SmartDialog.showToast('导入成功');
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('导入失败:$e');
|
||||
}
|
||||
final path = result.xFile.path;
|
||||
final data = await File(path).readAsString();
|
||||
final T json;
|
||||
try {
|
||||
json = jsonDecode(data);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('解析json失败:$e');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await onImport(json);
|
||||
SmartDialog.showToast('导入成功');
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('导入失败:$e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,8 +184,10 @@ class FavDetailController
|
||||
folderInfo
|
||||
..value.favState = isFav ? 0 : 1
|
||||
..refresh();
|
||||
SmartDialog.showToast('${isFav ? '取消' : ''}收藏成功');
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
res.toast();
|
||||
}
|
||||
|
||||
Future<void> cleanFav() async {
|
||||
|
||||
@@ -21,7 +21,7 @@ class PayCoinsPage extends StatefulWidget {
|
||||
required this.onPayCoin,
|
||||
int copyright = 1,
|
||||
this.hasCoin = false,
|
||||
}) : hasCopyright = copyright == 1;
|
||||
}) : hasCopyright = copyright != 2;
|
||||
|
||||
final Function(int coin, bool coinWithLike) onPayCoin;
|
||||
final bool hasCopyright;
|
||||
|
||||
@@ -189,6 +189,11 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isResume = state == .resumed;
|
||||
final ctr = videoDetailController.plPlayerController..visible = isResume;
|
||||
if (isResume) {
|
||||
// TODO: remove
|
||||
// part of https://github.com/flutter/flutter/issues/186723
|
||||
if (Platform.isAndroid && !showSystemBar_) {
|
||||
setEnabledSystemUIMode(.immersiveSticky);
|
||||
}
|
||||
if (!ctr.showDanmaku) {
|
||||
introController.startTimer();
|
||||
ctr.showDanmaku = true;
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -167,6 +167,7 @@ class ChatItem extends StatelessWidget {
|
||||
required dynamic content,
|
||||
required Color textColor,
|
||||
}) {
|
||||
return def(textColor, err: 'dev');
|
||||
try {
|
||||
switch (msgTypeFromValue(item.msgType)) {
|
||||
case MsgType.EN_MSG_TYPE_NOTIFY_MSG:
|
||||
|
||||
@@ -316,6 +316,7 @@ abstract final class ImageUtils {
|
||||
final savePath = await FilePicker.saveFile(
|
||||
type: FileType.image,
|
||||
fileName: fileName,
|
||||
bytes: Uint8List(0),
|
||||
);
|
||||
if (savePath == null) {
|
||||
SmartDialog.showToast("取消保存");
|
||||
@@ -353,6 +354,7 @@ abstract final class ImageUtils {
|
||||
final savePath = await FilePicker.saveFile(
|
||||
type: type,
|
||||
fileName: fileName,
|
||||
bytes: Uint8List(0),
|
||||
);
|
||||
if (savePath == null) {
|
||||
SmartDialog.showToast("取消保存");
|
||||
|
||||
@@ -17,7 +17,7 @@ abstract final class StorageUtils {
|
||||
allowedExtensions: allowedExtensions,
|
||||
type: type,
|
||||
fileName: name,
|
||||
bytes: PlatformUtils.isDesktop ? null : bytes,
|
||||
bytes: PlatformUtils.isDesktop ? Uint8List(0) : bytes,
|
||||
);
|
||||
if (path == null) {
|
||||
SmartDialog.showToast("取消保存");
|
||||
|
||||
65
pubspec.lock
65
pubspec.lock
@@ -237,10 +237,11 @@ packages:
|
||||
catcher_2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: catcher_2
|
||||
sha256: ac9dd03230fa4058d14d46450335ca3c40564f734d793e52f81053f3cbf95009
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: dev
|
||||
resolved-ref: a20878e9fe5375252c9ea22697d4dc4823544b1a
|
||||
url: "https://github.com/bggRGjQaUbCoE/catcher_2.git"
|
||||
source: git
|
||||
version: "2.1.9"
|
||||
characters:
|
||||
dependency: "direct main"
|
||||
@@ -287,10 +288,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_assets
|
||||
sha256: "83ccdaa064c980b5596c35dd64a8d3ecc68620174ab9b90b6343b753aa721687"
|
||||
sha256: dad6bf6b9f4f378b0a69edbf42584d336efd1a9ce15deb1ba591cbb1b5ff440f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.1.0"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -522,10 +523,10 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: dev
|
||||
resolved-ref: "8cf6cfa7078aa69c2c7b08d9ad636a1040456852"
|
||||
resolved-ref: f6c2ab82ce7539dc26e6c16e1455b435fd2ded09
|
||||
url: "https://github.com/bggRGjQaUbCoE/flutter_file_picker.git"
|
||||
source: git
|
||||
version: "12.0.0-beta.3"
|
||||
version: "12.0.0-beta.5"
|
||||
file_selector_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -710,10 +711,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_mailer
|
||||
sha256: "149e51d4e3ba12f8b61e1923ff4304f308acb856b92e9d09326bec6a1ad943d6"
|
||||
sha256: e1c0b4425e3cc789f8dd914fd08b5da660c3ac46c8ebf3e7db183d39775a8fa6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
flutter_native_splash:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -774,14 +775,6 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
fluttertoast:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fluttertoast
|
||||
sha256: "144ddd74d49c865eba47abe31cbc746c7b311c82d6c32e571fd73c4264b740e2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.0.0"
|
||||
font_awesome_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -844,10 +837,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hooks
|
||||
sha256: "025f060e86d2d4c3c47b56e33caf7f93bf9283340f26d23424ebcfccf34f621e"
|
||||
sha256: a41af4e8fc687cd6d33de9751eb936c8c0204ebe2bcb6c15ecf707504bf47f31
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "2.0.0"
|
||||
html:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1150,7 +1143,7 @@ packages:
|
||||
description:
|
||||
path: media_kit
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136"
|
||||
resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
|
||||
url: "https://github.com/My-Responsitories/media-kit.git"
|
||||
source: git
|
||||
version: "1.1.11"
|
||||
@@ -1159,7 +1152,7 @@ packages:
|
||||
description:
|
||||
path: "libs/android/media_kit_libs_android_video"
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136"
|
||||
resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
|
||||
url: "https://github.com/My-Responsitories/media-kit.git"
|
||||
source: git
|
||||
version: "1.3.7"
|
||||
@@ -1193,7 +1186,7 @@ packages:
|
||||
description:
|
||||
path: "libs/universal/media_kit_libs_video"
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136"
|
||||
resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
|
||||
url: "https://github.com/My-Responsitories/media-kit.git"
|
||||
source: git
|
||||
version: "1.0.5"
|
||||
@@ -1202,7 +1195,7 @@ packages:
|
||||
description:
|
||||
path: "libs/windows/media_kit_libs_windows_video"
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136"
|
||||
resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
|
||||
url: "https://github.com/My-Responsitories/media-kit.git"
|
||||
source: git
|
||||
version: "1.0.10"
|
||||
@@ -1211,7 +1204,7 @@ packages:
|
||||
description:
|
||||
path: media_kit_native_event_loop
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136"
|
||||
resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
|
||||
url: "https://github.com/My-Responsitories/media-kit.git"
|
||||
source: git
|
||||
version: "1.0.9"
|
||||
@@ -1220,7 +1213,7 @@ packages:
|
||||
description:
|
||||
path: media_kit_video
|
||||
ref: "version_1.2.5"
|
||||
resolved-ref: "14c3ee41df4f51292b89eaf8f8c97420220fe136"
|
||||
resolved-ref: "4f0f72e5bf21349bc251bf52761628faeae3f233"
|
||||
url: "https://github.com/My-Responsitories/media-kit.git"
|
||||
source: git
|
||||
version: "1.2.5"
|
||||
@@ -1257,14 +1250,6 @@ packages:
|
||||
url: "https://github.com/bggRGjQaUbCoE/flutter_native_device_orientation.git"
|
||||
source: git
|
||||
version: "2.0.5"
|
||||
native_toolchain_c:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: native_toolchain_c
|
||||
sha256: "6ba77bb18063eebe9de401f5e6437e95e1438af0a87a3a39084fbd37c90df572"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.17.6"
|
||||
nm:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1277,10 +1262,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: objective_c
|
||||
sha256: "02f4ff97ac95fa4abe561242eb033239e08e8903a46eaecf61b047761b89fe1f"
|
||||
sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.0"
|
||||
version: "9.4.1"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1867,10 +1852,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572"
|
||||
sha256: "17bc677f0b301615530dd1d67e0a9828cafa2d0b6b6eae4cd3679b7eac4a273c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.29"
|
||||
version: "6.3.30"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -2044,10 +2029,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: a1fc9eb9248baa05dfc12ed5b66e377b3e23f095eec078e0371622b9033810d9
|
||||
sha256: ba6f4bba816c8d7e3c1580e170f3786d216951cc6b94babc3b814c08d2cb2738
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.0"
|
||||
version: "6.3.0"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -46,7 +46,10 @@ dependencies:
|
||||
git:
|
||||
url: https://github.com/bggRGjQaUbCoE/canvas_danmaku.git
|
||||
ref: main
|
||||
catcher_2: ^2.1.0
|
||||
catcher_2:
|
||||
git:
|
||||
url: https://github.com/bggRGjQaUbCoE/catcher_2.git
|
||||
ref: dev
|
||||
characters: ^1.4.1
|
||||
chat_bottom_container:
|
||||
git:
|
||||
|
||||
Reference in New Issue
Block a user