From 6167288af224e78a46f8481afcbc4cd16a681482 Mon Sep 17 00:00:00 2001 From: orz12 Date: Sun, 7 Jul 2024 15:16:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=94=81=E5=AE=9A=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=9D=9E=E5=85=A8=E5=B1=8F=E6=97=B6=E9=9A=90=E8=97=8F=EF=BC=9B?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E6=96=B0=E5=A2=9E=E7=BB=93=E6=9E=9C=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E5=BC=B9=E7=AA=97=E9=81=BF=E5=85=8D=E8=AF=AF=E8=A7=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugin/pl_player/view.dart | 58 ++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 4f9fc561..08f1191a 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -983,7 +983,7 @@ class _PLVideoPlayerState extends State child: FractionalTranslation( translation: const Offset(1, -0.4), child: Visibility( - visible: _.showControls.value, + visible: _.showControls.value && _.isFullScreen.value, child: ComBtn( tooltip: _.controlsLock.value ? '解锁' : '锁定', icon: Icon( @@ -1016,20 +1016,58 @@ class _PLVideoPlayerState extends State size: 20, color: Colors.white, ), - fuc: () => { + fuc: () { + SmartDialog.showToast('截图中'); _.videoPlayerController ?.screenshot(format: 'image/png') .then((value) { if (value != null) { - SmartDialog.showToast('截图成功'); - String _name = DateTime.now().toString(); - SaverGallery.saveImage(value, - name: _name, - androidRelativePath: "Pictures/Screenshots", - androidExistNotSave: false); - SmartDialog.showToast('$_name.png已保存到相册/截图'); + SmartDialog.showToast('点击弹窗保存截图'); + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + // title: const Text('点击保存'), + titlePadding: EdgeInsets.zero, + contentPadding: const EdgeInsets.all(8), + insetPadding: + EdgeInsets.only(left: context.width / 2), + //移除圆角 + shape: const RoundedRectangleBorder(), + content: GestureDetector( + onTap: () async { + String name = DateTime.now().toString(); + final SaveResult result = + await SaverGallery.saveImage( + value, + name: name, + androidRelativePath: "Pictures/Screenshots", + androidExistNotSave: false, + ); + + if (result.isSuccess) { + Get.back(); + SmartDialog.showToast('$name.png已保存到相册/截图'); + } else { + await SmartDialog.showToast( + '保存失败,${result.errorMessage}'); + } + }, + child: ConstrainedBox( + constraints: BoxConstraints( + maxWidth: context.width / 3, + maxHeight: context.height / 3, + ), + child: Image.memory(value), + ), + ), + ); + }, + ); + } else { + SmartDialog.showToast('截图失败'); } - }) + }); }, ), ),