From 3c9a97181bdba4fa12096d69534a7a11006d5724 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Tue, 15 Aug 2023 10:08:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A8=8D=E5=90=8E=E5=86=8D=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/widgets/video_card_h.dart | 75 +++++++++++++++------------- lib/common/widgets/video_card_v.dart | 68 +++++++++++++------------ lib/pages/later/view.dart | 1 + 3 files changed, 76 insertions(+), 68 deletions(-) diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart index 37e227b6..1a61f922 100644 --- a/lib/common/widgets/video_card_h.dart +++ b/lib/common/widgets/video_card_h.dart @@ -16,12 +16,14 @@ class VideoCardH extends StatelessWidget { final videoItem; final Function()? longPress; final Function()? longPressEnd; + final String source; const VideoCardH({ Key? key, required this.videoItem, this.longPress, this.longPressEnd, + this.source = 'normal', }) : super(key: key); @override @@ -92,7 +94,7 @@ class VideoCardH extends StatelessWidget { }, ), ), - VideoContent(videoItem: videoItem) + VideoContent(videoItem: videoItem, source: source) ], ), ); @@ -107,7 +109,9 @@ class VideoCardH extends StatelessWidget { class VideoContent extends StatelessWidget { // ignore: prefer_typing_uninitialized_variables final videoItem; - const VideoContent({super.key, required this.videoItem}); + final String source; + const VideoContent( + {super.key, required this.videoItem, this.source = 'normal'}); @override Widget build(BuildContext context) { @@ -217,41 +221,42 @@ class VideoContent extends StatelessWidget { // ), // ), // ), - SizedBox( - width: 24, - height: 24, - child: PopupMenuButton( - padding: EdgeInsets.zero, - tooltip: '稍后再看', - icon: Icon( - Icons.more_vert_outlined, - color: Theme.of(context).colorScheme.outline, - size: 14, - ), - position: PopupMenuPosition.under, - // constraints: const BoxConstraints(maxHeight: 35), - onSelected: (String type) {}, - itemBuilder: (BuildContext context) => - >[ - PopupMenuItem( - onTap: () async { - var res = - await UserHttp.toViewLater(bvid: videoItem.bvid); - SmartDialog.showToast(res['msg']); - }, - value: 'pause', - height: 35, - child: const Row( - children: [ - Icon(Icons.watch_later_outlined, size: 16), - SizedBox(width: 6), - Text('稍后再看', style: TextStyle(fontSize: 13)) - ], - ), + if (source == 'normal') + SizedBox( + width: 24, + height: 24, + child: PopupMenuButton( + padding: EdgeInsets.zero, + tooltip: '稍后再看', + icon: Icon( + Icons.more_vert_outlined, + color: Theme.of(context).colorScheme.outline, + size: 14, ), - ], + position: PopupMenuPosition.under, + // constraints: const BoxConstraints(maxHeight: 35), + onSelected: (String type) {}, + itemBuilder: (BuildContext context) => + >[ + PopupMenuItem( + onTap: () async { + var res = await UserHttp.toViewLater( + bvid: videoItem.bvid); + SmartDialog.showToast(res['msg']); + }, + value: 'pause', + height: 35, + child: const Row( + children: [ + Icon(Icons.watch_later_outlined, size: 16), + SizedBox(width: 6), + Text('稍后再看', style: TextStyle(fontSize: 13)) + ], + ), + ), + ], + ), ), - ), ], ), ], diff --git a/lib/common/widgets/video_card_v.dart b/lib/common/widgets/video_card_v.dart index 92422c09..ffc6b8bf 100644 --- a/lib/common/widgets/video_card_v.dart +++ b/lib/common/widgets/video_card_v.dart @@ -210,41 +210,43 @@ class VideoContent extends StatelessWidget { ); }), ), - SizedBox( - width: 24, - height: 24, - child: PopupMenuButton( - padding: EdgeInsets.zero, - tooltip: '稍后再看', - icon: Icon( - Icons.more_vert_outlined, - color: Theme.of(context).colorScheme.outline, - size: 14, - ), - position: PopupMenuPosition.under, - // constraints: const BoxConstraints(maxHeight: 35), - onSelected: (String type) {}, - itemBuilder: (BuildContext context) => - >[ - PopupMenuItem( - onTap: () async { - var res = - await UserHttp.toViewLater(bvid: videoItem.bvid); - SmartDialog.showToast(res['msg']); - }, - value: 'pause', - height: 35, - child: const Row( - children: [ - Icon(Icons.watch_later_outlined, size: 16), - SizedBox(width: 6), - Text('稍后再看', style: TextStyle(fontSize: 13)) - ], - ), + if (videoItem.goto == 'av') + SizedBox( + width: 24, + height: 24, + child: PopupMenuButton( + padding: EdgeInsets.zero, + tooltip: '稍后再看', + icon: Icon( + Icons.more_vert_outlined, + color: Theme.of(context).colorScheme.outline, + size: 14, ), - ], + position: PopupMenuPosition.under, + // constraints: const BoxConstraints(maxHeight: 35), + onSelected: (String type) {}, + itemBuilder: (BuildContext context) => + >[ + PopupMenuItem( + onTap: () async { + int aid = videoItem.param; + var res = await UserHttp.toViewLater( + bvid: IdUtils.av2bv(aid)); + SmartDialog.showToast(res['msg']); + }, + value: 'pause', + height: 35, + child: const Row( + children: [ + Icon(Icons.watch_later_outlined, size: 16), + SizedBox(width: 6), + Text('稍后再看', style: TextStyle(fontSize: 13)) + ], + ), + ), + ], + ), ), - ), ], ), // Row( diff --git a/lib/pages/later/view.dart b/lib/pages/later/view.dart index a3389334..d3306b25 100644 --- a/lib/pages/later/view.dart +++ b/lib/pages/later/view.dart @@ -65,6 +65,7 @@ class _LaterPageState extends State { delegate: SliverChildBuilderDelegate((context, index) { return VideoCardH( videoItem: _laterController.laterList[index], + source: 'later', ); }, childCount: _laterController.laterList.length), ),