fix: save reply

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-07 09:50:19 +08:00
parent 8719c8f639
commit b14844f459
3 changed files with 21 additions and 8 deletions

View File

@@ -389,7 +389,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
PopupMenuItem( PopupMenuItem(
onTap: () { onTap: () {
DownloadUtils.downloadImg( DownloadUtils.downloadImg(
context, this.context,
[widget.sources[currentIndex.value].url], [widget.sources[currentIndex.value].url],
); );
}, },
@@ -399,7 +399,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
PopupMenuItem( PopupMenuItem(
onTap: () { onTap: () {
DownloadUtils.downloadImg( DownloadUtils.downloadImg(
context, this.context,
widget.sources widget.sources
.map((item) => item.url) .map((item) => item.url)
.toList(), .toList(),
@@ -412,7 +412,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
PopupMenuItem( PopupMenuItem(
onTap: () { onTap: () {
DownloadUtils.downloadLivePhoto( DownloadUtils.downloadLivePhoto(
context: context, context: this.context,
url: widget.sources[currentIndex.value].url, url: widget.sources[currentIndex.value].url,
liveUrl: widget liveUrl: widget
.sources[currentIndex.value].liveUrl!, .sources[currentIndex.value].liveUrl!,
@@ -567,7 +567,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
onTap: () { onTap: () {
Get.back(); Get.back();
DownloadUtils.downloadImg( DownloadUtils.downloadImg(
context, this.context,
[widget.sources[currentIndex.value].url], [widget.sources[currentIndex.value].url],
); );
}, },
@@ -579,7 +579,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
onTap: () { onTap: () {
Get.back(); Get.back();
DownloadUtils.downloadImg( DownloadUtils.downloadImg(
context, this.context,
widget.sources.map((item) => item.url).toList(), widget.sources.map((item) => item.url).toList(),
); );
}, },
@@ -592,7 +592,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
onTap: () { onTap: () {
Get.back(); Get.back();
DownloadUtils.downloadLivePhoto( DownloadUtils.downloadLivePhoto(
context: context, context: this.context,
url: widget.sources[currentIndex.value].url, url: widget.sources[currentIndex.value].url,
liveUrl: widget.sources[currentIndex.value].liveUrl!, liveUrl: widget.sources[currentIndex.value].liveUrl!,
width: widget.sources[currentIndex.value].width!, width: widget.sources[currentIndex.value].width!,

View File

@@ -1211,7 +1211,7 @@ class ReplyItemGrpc extends StatelessWidget {
barrierLabel: '', barrierLabel: '',
barrierDismissible: true, barrierDismissible: true,
pageBuilder: (context, animation, secondaryAnimation) { pageBuilder: (context, animation, secondaryAnimation) {
return ReplySavePanel(replyItem: item); return ReplySavePanel(upMid: upMid, replyItem: item);
}, },
transitionDuration: const Duration(milliseconds: 255), transitionDuration: const Duration(milliseconds: 255),
transitionBuilder: (context, animation, secondaryAnimation, child) { transitionBuilder: (context, animation, secondaryAnimation, child) {

View File

@@ -7,6 +7,7 @@ import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/models/dynamics/result.dart';
import 'package:PiliPlus/pages/video/detail/introduction/controller.dart'; import 'package:PiliPlus/pages/video/detail/introduction/controller.dart';
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart'; import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart';
import 'package:PiliPlus/utils/download.dart';
import 'package:PiliPlus/utils/utils.dart'; import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@@ -17,8 +18,13 @@ import 'package:saver_gallery/saver_gallery.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
class ReplySavePanel extends StatefulWidget { class ReplySavePanel extends StatefulWidget {
const ReplySavePanel({required this.replyItem, super.key}); const ReplySavePanel({
required this.upMid,
required this.replyItem,
super.key,
});
final dynamic upMid;
final ReplyInfo replyItem; final ReplyInfo replyItem;
@override @override
@@ -29,6 +35,12 @@ class _ReplySavePanelState extends State<ReplySavePanel> {
final boundaryKey = GlobalKey(); final boundaryKey = GlobalKey();
void _onSaveOrSharePic([bool isShare = false]) async { void _onSaveOrSharePic([bool isShare = false]) async {
if (!isShare) {
if (mounted &&
!await DownloadUtils.checkPermissionDependOnSdkInt(context)) {
return;
}
}
SmartDialog.showLoading(); SmartDialog.showLoading();
try { try {
RenderRepaintBoundary boundary = boundaryKey.currentContext! RenderRepaintBoundary boundary = boundaryKey.currentContext!
@@ -185,6 +197,7 @@ class _ReplySavePanelState extends State<ReplySavePanel> {
showReplyRow: false, showReplyRow: false,
replyLevel: '', replyLevel: '',
needDivider: false, needDivider: false,
upMid: widget.upMid,
), ),
), ),
if (cover?.isNotEmpty == true && if (cover?.isNotEmpty == true &&