Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-29 13:35:51 +08:00
parent bcbfe5c849
commit 5979ddb60c
46 changed files with 3266 additions and 3293 deletions

View File

@@ -140,69 +140,68 @@ class PgcIntroController extends CommonIntroController {
// 分享视频
@override
void actionShareVideo(BuildContext context) {
String videoUrl =
'${HttpString.baseUrl}/bangumi/play/ep$epId${videoDetailCtr.playedTimePos}';
showDialog(
context: context,
builder: (_) {
String videoUrl =
'${HttpString.baseUrl}/bangumi/play/ep$epId${videoDetailCtr.playedTimePos}';
return AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
builder: (_) => AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
dense: true,
title: const Text(
'复制链接',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
Utils.copyText(videoUrl);
},
),
ListTile(
dense: true,
title: const Text(
'其它app打开',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
PageUtils.launchURL(videoUrl);
},
),
if (PlatformUtils.isMobile)
ListTile(
dense: true,
title: const Text(
'复制链接',
'分享视频',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
Utils.copyText(videoUrl);
Utils.shareText(videoUrl);
},
),
ListTile(
dense: true,
title: const Text(
'其它app打开',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
PageUtils.launchURL(videoUrl);
},
ListTile(
dense: true,
title: const Text(
'分享至动态',
style: TextStyle(fontSize: 14),
),
if (PlatformUtils.isMobile)
ListTile(
dense: true,
title: const Text(
'分享视频',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
Utils.shareText(videoUrl);
},
),
ListTile(
dense: true,
title: const Text(
'分享至动态',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
EpisodeItem? item = pgcItem.episodes?.firstWhereOrNull(
(item) => item.epId == epId,
);
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: epId,
/**
onTap: () {
Get.back();
EpisodeItem? item = pgcItem.episodes?.firstWhereOrNull(
(item) => item.epId == epId,
);
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: epId,
/**
* 1番剧 // 4097
2电影 // 4098
3纪录片 // 4101
@@ -211,67 +210,66 @@ class PgcIntroController extends CommonIntroController {
6漫画
7综艺 // 4099
*/
dynType: switch (pgcItem.type) {
1 => 4097,
2 => 4098,
3 => 4101,
4 => 4100,
5 || 7 => 4099,
_ => -1,
},
pic: pgcItem.cover,
title:
'${pgcItem.title}${item != null ? '\n${item.showTitle}' : ''}',
uname: '',
),
dynType: switch (pgcItem.type) {
1 => 4097,
2 => 4098,
3 => 4101,
4 => 4100,
5 || 7 => 4099,
_ => -1,
},
pic: pgcItem.cover,
title:
'${pgcItem.title}${item != null ? '\n${item.showTitle}' : ''}',
uname: '',
),
);
},
),
ListTile(
dense: true,
title: const Text(
'分享至消息',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
try {
EpisodeItem item = pgcItem.episodes!.firstWhere(
(item) => item.epId == epId,
);
},
),
ListTile(
dense: true,
title: const Text(
'分享至消息',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
try {
EpisodeItem item = pgcItem.episodes!.firstWhere(
(item) => item.epId == epId,
);
final title =
item.shareCopy ??
'${pgcItem.title} ${item.showTitle ?? item.longTitle}';
PageUtils.pmShare(
context,
content: {
"id": epId!.toString(),
"title": title,
"url": item.shareUrl,
"headline": title,
"source": 16,
"thumb": item.cover,
"source_desc": switch (pgcItem.type) {
1 => '番剧',
2 => '电影',
3 => '纪录片',
4 => '国创',
5 => '电视剧',
6 => '漫画',
7 => '综艺',
_ => null,
},
final title =
item.shareCopy ??
'${pgcItem.title} ${item.showTitle ?? item.longTitle}';
PageUtils.pmShare(
context,
content: {
"id": epId!.toString(),
"title": title,
"url": item.shareUrl,
"headline": title,
"source": 16,
"thumb": item.cover,
"source_desc": switch (pgcItem.type) {
1 => '番剧',
2 => '电影',
3 => '纪录片',
4 => '国创',
5 => '电视剧',
6 => '漫画',
7 => '综艺',
_ => null,
},
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
),
],
),
);
},
},
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
),
],
),
),
);
}

View File

@@ -298,108 +298,106 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
// 分享视频
@override
void actionShareVideo(BuildContext context) {
final videoDetail = this.videoDetail.value;
String videoUrl =
'${HttpString.baseUrl}/video/$bvid${videoDetailCtr.playedTimePos}';
showDialog(
context: context,
builder: (_) {
final videoDetail = this.videoDetail.value;
String videoUrl =
'${HttpString.baseUrl}/video/$bvid${videoDetailCtr.playedTimePos}';
return AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
dense: true,
title: const Text(
'复制链接',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
Utils.copyText(videoUrl);
},
builder: (_) => AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
dense: true,
title: const Text(
'复制链接',
style: TextStyle(fontSize: 14),
),
ListTile(
dense: true,
title: const Text(
'其它app打开',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
PageUtils.launchURL(videoUrl);
},
onTap: () {
Get.back();
Utils.copyText(videoUrl);
},
),
ListTile(
dense: true,
title: const Text(
'其它app打开',
style: TextStyle(fontSize: 14),
),
if (PlatformUtils.isMobile)
ListTile(
dense: true,
title: const Text(
'分享视频',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
Utils.shareText(
'${videoDetail.title} '
'UP主: ${videoDetail.owner!.name!}'
' - $videoUrl',
);
},
),
onTap: () {
Get.back();
PageUtils.launchURL(videoUrl);
},
),
if (PlatformUtils.isMobile)
ListTile(
dense: true,
title: const Text(
'分享至动态',
'分享视频',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: videoDetail.aid,
dynType: 8,
pic: videoDetail.pic,
title: videoDetail.title,
uname: videoDetail.owner?.name,
),
Utils.shareText(
'${videoDetail.title} '
'UP主: ${videoDetail.owner!.name!}'
' - $videoUrl',
);
},
),
ListTile(
dense: true,
title: const Text(
'分享至消息',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
try {
PageUtils.pmShare(
context,
content: {
"id": videoDetail.aid!.toString(),
"title": videoDetail.title!,
"headline": videoDetail.title!,
"source": 5,
"thumb": videoDetail.pic!,
"author": videoDetail.owner!.name!,
"author_id": videoDetail.owner!.mid!.toString(),
},
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
ListTile(
dense: true,
title: const Text(
'分享至动态',
style: TextStyle(fontSize: 14),
),
],
),
);
},
onTap: () {
Get.back();
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: videoDetail.aid,
dynType: 8,
pic: videoDetail.pic,
title: videoDetail.title,
uname: videoDetail.owner?.name,
),
);
},
),
ListTile(
dense: true,
title: const Text(
'分享至消息',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
try {
PageUtils.pmShare(
context,
content: {
"id": videoDetail.aid!.toString(),
"title": videoDetail.title!,
"headline": videoDetail.title!,
"source": 5,
"thumb": videoDetail.pic!,
"author": videoDetail.owner!.name!,
"author_id": videoDetail.owner!.mid!.toString(),
},
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
),
],
),
),
);
}

View File

@@ -104,36 +104,34 @@ class PostPanel extends CommonSlidePage {
tooltip: '编辑',
icon: const Icon(Icons.edit),
onPressed: () async {
String initV = value;
final res = await showDialog<String>(
context: context,
builder: (context) {
String initV = value;
return AlertDialog(
content: TextFormField(
initialValue: value,
autofocus: true,
onChanged: (value) => initV = value,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[\d:.]+')),
],
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: theme.colorScheme.outline,
),
builder: (context) => AlertDialog(
content: TextFormField(
initialValue: value,
autofocus: true,
onChanged: (value) => initV = value,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[\d:.]+')),
],
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: theme.colorScheme.outline,
),
),
TextButton(
onPressed: () => Get.back(result: initV),
child: const Text('确定'),
),
],
);
},
),
TextButton(
onPressed: () => Get.back(result: initV),
child: const Text('确定'),
),
],
),
);
if (res != null) {

View File

@@ -976,17 +976,15 @@ class ReplyItemGrpc extends StatelessWidget {
Get.back();
showDialog(
context: context,
builder: (context) {
return Dialog(
child: Padding(
padding: const .symmetric(horizontal: 20, vertical: 16),
child: SelectableText(
message,
style: const TextStyle(fontSize: 15, height: 1.7),
),
builder: (context) => Dialog(
child: Padding(
padding: const .symmetric(horizontal: 20, vertical: 16),
child: SelectableText(
message,
style: const TextStyle(fontSize: 15, height: 1.7),
),
);
},
),
),
);
},
minLeadingWidth: 0,

View File

@@ -536,11 +536,9 @@ class HeaderControlState extends State<HeaderControl>
Get.back();
final result = await showDialog<CDNService>(
context: context,
builder: (context) {
return CdnSelectDialog(
sample: videoInfo.dash?.video?.firstOrNull,
);
},
builder: (context) => CdnSelectDialog(
sample: videoInfo.dash?.video?.firstOrNull,
),
);
if (result != null) {
VideoUtils.cdnService = result;
@@ -1230,68 +1228,66 @@ class HeaderControlState extends State<HeaderControl>
void onExportSubtitle() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
title: const Text('保存字幕'),
content: SingleChildScrollView(
child: Column(
children: videoDetailCtr.subtitles
.map(
(item) => ListTile(
dense: true,
onTap: () async {
Get.back();
final url = item.subtitleUrl;
if (url == null || url.isEmpty) return;
try {
final res = await Request.dio.get<Uint8List>(
url.http2https,
options: Options(
responseType: ResponseType.bytes,
headers: Constants.baseHeaders,
extra: {'account': const NoAccount()},
builder: (context) => AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
title: const Text('保存字幕'),
content: SingleChildScrollView(
child: Column(
children: videoDetailCtr.subtitles
.map(
(item) => ListTile(
dense: true,
onTap: () async {
Get.back();
final url = item.subtitleUrl;
if (url == null || url.isEmpty) return;
try {
final res = await Request.dio.get<Uint8List>(
url.http2https,
options: Options(
responseType: ResponseType.bytes,
headers: Constants.baseHeaders,
extra: {'account': const NoAccount()},
),
);
if (res.statusCode == 200) {
final bytes = Uint8List.fromList(
Request.responseBytesDecoder(
res.data!,
res.headers.map,
),
);
if (res.statusCode == 200) {
final bytes = Uint8List.fromList(
Request.responseBytesDecoder(
res.data!,
res.headers.map,
),
);
String name =
'${introController.videoDetail.value.title}-${videoDetailCtr.bvid}-${videoDetailCtr.cid.value}-${item.lanDoc}.json';
if (Platform.isWindows) {
// Reserved characters may not be used in file names. See: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
name = name.replaceAll(
RegExp(r'[<>:/\\|?*"]'),
'',
);
}
Utils.saveBytes2File(
name: name,
bytes: bytes,
allowedExtensions: const ['json'],
String name =
'${introController.videoDetail.value.title}-${videoDetailCtr.bvid}-${videoDetailCtr.cid.value}-${item.lanDoc}.json';
if (Platform.isWindows) {
// Reserved characters may not be used in file names. See: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
name = name.replaceAll(
RegExp(r'[<>:/\\|?*"]'),
'',
);
}
} catch (e, s) {
Utils.reportError(e, s);
SmartDialog.showToast(e.toString());
Utils.saveBytes2File(
name: name,
bytes: bytes,
allowedExtensions: const ['json'],
);
}
},
title: Text(
item.lanDoc!,
style: const TextStyle(fontSize: 14),
),
} catch (e, s) {
Utils.reportError(e, s);
SmartDialog.showToast(e.toString());
}
},
title: Text(
item.lanDoc!,
style: const TextStyle(fontSize: 14),
),
)
.toList(),
),
),
)
.toList(),
),
);
},
),
),
);
}