mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-26 02:58:39 +00:00
Open offline dir on desktop
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
|
import 'dart:io' show Platform, Process;
|
||||||
|
|
||||||
import 'package:PiliPlus/models/common/video/video_type.dart';
|
import 'package:PiliPlus/models/common/video/video_type.dart';
|
||||||
import 'package:PiliPlus/pages/common/multi_select/base.dart'
|
import 'package:PiliPlus/pages/common/multi_select/base.dart'
|
||||||
show MultiSelectData;
|
show MultiSelectData;
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/route_manager.dart';
|
import 'package:get/route_manager.dart';
|
||||||
|
|
||||||
class BiliDownloadEntryInfo with MultiSelectData {
|
class BiliDownloadEntryInfo with MultiSelectData {
|
||||||
@@ -68,10 +72,7 @@ class BiliDownloadEntryInfo with MultiSelectData {
|
|||||||
itemBuilder: (_) => [
|
itemBuilder: (_) => [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
height: 38,
|
height: 38,
|
||||||
child: const Text(
|
child: const Text('查看详情页', style: TextStyle(fontSize: 13)),
|
||||||
'查看详情页',
|
|
||||||
style: TextStyle(fontSize: 13),
|
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (ep case final ep?) {
|
if (ep case final ep?) {
|
||||||
if (ep.from == VideoType.pugv.name) {
|
if (ep.from == VideoType.pugv.name) {
|
||||||
@@ -97,14 +98,34 @@ class BiliDownloadEntryInfo with MultiSelectData {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (PlatformUtils.isDesktop)
|
||||||
|
PopupMenuItem(
|
||||||
|
height: 38,
|
||||||
|
child: const Text('打开本地文件夹', style: TextStyle(fontSize: 13)),
|
||||||
|
onTap: () async {
|
||||||
|
try {
|
||||||
|
final String executable;
|
||||||
|
if (Platform.isWindows) {
|
||||||
|
executable = 'explorer';
|
||||||
|
} else if (Platform.isMacOS) {
|
||||||
|
executable = 'open';
|
||||||
|
} else if (Platform.isLinux) {
|
||||||
|
executable = 'xdg-open';
|
||||||
|
} else {
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
await Process.run(executable, [entryDirPath]);
|
||||||
|
} catch (e) {
|
||||||
|
SmartDialog.showToast(e.toString());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
if (ownerId case final mid?)
|
if (ownerId case final mid?)
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
height: 38,
|
height: 38,
|
||||||
child: Text(
|
child: Text(
|
||||||
'访问${ownerName != null ? ':$ownerName' : '用户主页'}',
|
'访问${ownerName != null ? ':$ownerName' : '用户主页'}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 13),
|
||||||
fontSize: 13,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTap: () => Get.toNamed('/member?mid=$mid'),
|
onTap: () => Get.toNamed('/member?mid=$mid'),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user