From cdb8f6845cea2fa1bf00b3f1b56042546192d182 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Tue, 11 Feb 2025 21:44:28 +0800 Subject: [PATCH] mod: history card menu Signed-off-by: bggRGjQaUbCoE --- lib/pages/dynamics/widgets/live_panel.dart | 1 + lib/pages/history/widgets/item.dart | 110 ++++++++++++--------- lib/pages/live/view.dart | 3 +- 3 files changed, 68 insertions(+), 46 deletions(-) diff --git a/lib/pages/dynamics/widgets/live_panel.dart b/lib/pages/dynamics/widgets/live_panel.dart index 7f595a56..3641d321 100644 --- a/lib/pages/dynamics/widgets/live_panel.dart +++ b/lib/pages/dynamics/widgets/live_panel.dart @@ -61,6 +61,7 @@ Widget livePanel(item, context, {floor = 1}) { Get.toNamed('/liveRoom?roomid=${content.live?.id}'); }, onLongPress: () { + Feedback.forLongPress(context); imageSaveDialog( context: context, title: content.live.title, diff --git a/lib/pages/history/widgets/item.dart b/lib/pages/history/widgets/item.dart index 40920496..82e4532f 100644 --- a/lib/pages/history/widgets/item.dart +++ b/lib/pages/history/widgets/item.dart @@ -1,5 +1,6 @@ import 'package:PiliPlus/common/widgets/image_save.dart'; import 'package:PiliPlus/common/widgets/video_progress_indicator.dart'; +import 'package:PiliPlus/models/user/history.dart'; import 'package:PiliPlus/pages/common/multi_select_controller.dart'; import 'package:PiliPlus/pages/fav_search/controller.dart'; import 'package:PiliPlus/utils/app_scheme.dart'; @@ -16,6 +17,7 @@ import 'package:PiliPlus/models/common/business_type.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/id_utils.dart'; import 'package:PiliPlus/utils/utils.dart'; +import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; class HistoryItem extends StatelessWidget { final dynamic videoItem; @@ -340,59 +342,79 @@ class HistoryItem extends StatelessWidget { fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, color: Theme.of(context).colorScheme.outline), ), - SizedBox( - width: 24, - height: 24, - child: PopupMenuButton( - padding: EdgeInsets.zero, - tooltip: '功能菜单', - icon: Icon( - Icons.more_vert_outlined, - color: Theme.of(context).colorScheme.outline, - size: 18, - ), - position: PopupMenuPosition.under, - // constraints: const BoxConstraints(maxHeight: 35), - onSelected: (String type) {}, - itemBuilder: (BuildContext context) => - >[ - if (videoItem.history?.business != 'pgc' && - videoItem.badge != '番剧' && - !videoItem.tagName.contains('动画') && - videoItem.history.business != 'live' && - !videoItem.history.business.contains('article')) + if (videoItem is HisListItem) + SizedBox( + width: 29, + height: 29, + child: PopupMenuButton( + padding: EdgeInsets.zero, + tooltip: '功能菜单', + icon: Icon( + Icons.more_vert_outlined, + color: Theme.of(context).colorScheme.outline, + size: 18, + ), + position: PopupMenuPosition.under, + itemBuilder: (BuildContext context) => + >[ + if (videoItem.authorMid != null && + videoItem.authorName?.isNotEmpty == true) + PopupMenuItem( + onTap: () { + Get.toNamed( + '/member?mid=${videoItem.authorMid}', + arguments: { + 'heroTag': '${videoItem.authorMid}', + }, + ); + }, + height: 35, + child: Row( + children: [ + Icon(MdiIcons.accountCircleOutline, size: 16), + SizedBox(width: 6), + Text( + '访问:${videoItem.authorName}', + style: TextStyle(fontSize: 13), + ) + ], + ), + ), + if (videoItem.history?.business != 'pgc' && + videoItem.badge != '番剧' && + !videoItem.tagName.contains('动画') && + videoItem.history.business != 'live' && + !videoItem.history.business.contains('article')) + PopupMenuItem( + onTap: () async { + var res = await UserHttp.toViewLater( + bvid: videoItem.history.bvid); + SmartDialog.showToast(res['msg']); + }, + height: 35, + child: const Row( + children: [ + Icon(Icons.watch_later_outlined, size: 16), + SizedBox(width: 6), + Text('稍后再看', style: TextStyle(fontSize: 13)) + ], + ), + ), PopupMenuItem( - onTap: () async { - var res = await UserHttp.toViewLater( - bvid: videoItem.history.bvid); - SmartDialog.showToast(res['msg']); - }, - value: 'pause', + onTap: () => ctr!.delHistory( + videoItem.kid, videoItem.history.business), height: 35, child: const Row( children: [ - Icon(Icons.watch_later_outlined, size: 16), + Icon(Icons.close_outlined, size: 16), SizedBox(width: 6), - Text('稍后再看', style: TextStyle(fontSize: 13)) + Text('删除记录', style: TextStyle(fontSize: 13)) ], ), ), - PopupMenuItem( - onTap: () => ctr!.delHistory( - videoItem.kid, videoItem.history.business), - value: 'pause', - height: 35, - child: const Row( - children: [ - Icon(Icons.close_outlined, size: 16), - SizedBox(width: 6), - Text('删除记录', style: TextStyle(fontSize: 13)) - ], - ), - ), - ], + ], + ), ), - ), ], ), ], diff --git a/lib/pages/live/view.dart b/lib/pages/live/view.dart index 746d885c..eaf9ffed 100644 --- a/lib/pages/live/view.dart +++ b/lib/pages/live/view.dart @@ -8,7 +8,6 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/pages/live/controller.dart'; import 'package:PiliPlus/pages/live/widgets/live_item.dart'; import 'package:PiliPlus/pages/live/widgets/live_item_follow.dart'; -import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -226,7 +225,7 @@ class _LivePageState extends State ); }, onLongPress: () { - feedBack(); + Feedback.forLongPress(context); Get.toNamed( '/member?mid=${loadingState.response[index].uid}', arguments: {