mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08: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/pages/common/multi_select/base.dart'
|
||||
show MultiSelectData;
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/route_manager.dart';
|
||||
|
||||
class BiliDownloadEntryInfo with MultiSelectData {
|
||||
@@ -68,10 +72,7 @@ class BiliDownloadEntryInfo with MultiSelectData {
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(
|
||||
height: 38,
|
||||
child: const Text(
|
||||
'查看详情页',
|
||||
style: TextStyle(fontSize: 13),
|
||||
),
|
||||
child: const Text('查看详情页', style: TextStyle(fontSize: 13)),
|
||||
onTap: () {
|
||||
if (ep case final ep?) {
|
||||
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?)
|
||||
PopupMenuItem(
|
||||
height: 38,
|
||||
child: Text(
|
||||
'访问${ownerName != null ? ':$ownerName' : '用户主页'}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
),
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
onTap: () => Get.toNamed('/member?mid=$mid'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user