diff --git a/lib/pages/fav/view.dart b/lib/pages/fav/view.dart index 307c7a0d..8ef4927b 100644 --- a/lib/pages/fav/view.dart +++ b/lib/pages/fav/view.dart @@ -76,14 +76,17 @@ class _FavPageState extends State with SingleTickerProviderStateMixin { final item = (_favController.loadingState.value as Success) .response .first; - Get.toNamed('/favSearch', arguments: { - 'type': 1, - 'mediaId': item.id, - 'title': item.title, - 'count': item.mediaCount, - 'searchType': SearchType.fav, - 'isOwner': true, - }); + Get.toNamed( + '/favSearch', + arguments: { + 'type': 1, + 'mediaId': item.id, + 'title': item.title, + 'count': item.mediaCount, + 'searchType': SearchType.fav, + 'isOwner': true, + }, + ); } catch (_) {} } }, diff --git a/lib/pages/fav_detail/fav_sort_page.dart b/lib/pages/fav_detail/fav_sort_page.dart index 6a99e138..553129a3 100644 --- a/lib/pages/fav_detail/fav_sort_page.dart +++ b/lib/pages/fav_detail/fav_sort_page.dart @@ -132,7 +132,6 @@ class _FavSortPageState extends State { FavVideoCardH( isSort: true, videoItem: item, - isOwner: false, ), if (BuildConfig.isDebug) Positioned( diff --git a/lib/pages/fav_detail/view.dart b/lib/pages/fav_detail/view.dart index 155901e6..3085f98e 100644 --- a/lib/pages/fav_detail/view.dart +++ b/lib/pages/fav_detail/view.dart @@ -475,11 +475,13 @@ class _FavDetailPageState extends State { Positioned.fill( child: FavVideoCardH( videoItem: item, - callFn: () => _favDetailController.onCancelFav( - index, - item.id!, - item.type!, - ), + onDelFav: _favDetailController.isOwner.value + ? () => _favDetailController.onCancelFav( + index, + item.id!, + item.type!, + ) + : null, onViewFav: () { Utils.toViewPage( 'bvid=${item.bvid}&cid=${item.cid}', @@ -514,7 +516,6 @@ class _FavDetailPageState extends State { } } : null, - isOwner: _favDetailController.isOwner.value, ), ), Positioned( diff --git a/lib/pages/fav_detail/widget/fav_video_card.dart b/lib/pages/fav_detail/widget/fav_video_card.dart index 872980db..855d57c5 100644 --- a/lib/pages/fav_detail/widget/fav_video_card.dart +++ b/lib/pages/fav_detail/widget/fav_video_card.dart @@ -17,22 +17,18 @@ import '../../../common/widgets/badge.dart'; // 收藏视频卡片 - 水平布局 class FavVideoCardH extends StatelessWidget { final FavDetailItemData videoItem; - final Function? callFn; - final int? searchType; final GestureTapCallback? onTap; final GestureLongPressCallback? onLongPress; - final bool isOwner; + final VoidCallback? onDelFav; final VoidCallback? onViewFav; final bool? isSort; const FavVideoCardH({ super.key, required this.videoItem, - this.callFn, - this.searchType, + this.onDelFav, this.onTap, this.onLongPress, - this.isOwner = false, this.onViewFav, this.isSort, }); @@ -210,7 +206,7 @@ class FavVideoCardH extends StatelessWidget { ), ], ), - if (searchType != 1 && isOwner) + if (onDelFav != null) Positioned( right: 0, bottom: 0, @@ -237,9 +233,9 @@ class FavVideoCardH extends StatelessWidget { ), ), TextButton( - onPressed: () async { - await callFn?.call(); + onPressed: () { Get.back(); + onDelFav!(); }, child: const Text('确定取消'), ) diff --git a/lib/pages/fav_search/view.dart b/lib/pages/fav_search/view.dart index c1a11ee0..234893c3 100644 --- a/lib/pages/fav_search/view.dart +++ b/lib/pages/fav_search/view.dart @@ -96,9 +96,7 @@ class _FavSearchPageState extends State { return _favSearchCtr.searchType == SearchType.fav ? FavVideoCardH( videoItem: item, - isOwner: _favSearchCtr.isOwner ?? false, - searchType: _favSearchCtr.type, - callFn: _favSearchCtr.type != 1 + onDelFav: _favSearchCtr.isOwner == true ? () { _favSearchCtr.onCancelFav( index,