From 1395f7ebf3e36659e3cb40e039d67007a7806f78 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 2 Dec 2024 21:01:33 +0800 Subject: [PATCH] opt: watchLater visible logic --- lib/pages/video/detail/controller.dart | 6 ++---- lib/pages/video/detail/view.dart | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index cc2cbffc..3d0d68e9 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -624,10 +624,8 @@ class VideoDetailController extends GetxController } void toggeleWatchLaterVisible(bool val) { - if (sourceType.value == 'watchLater' || - sourceType.value == 'fav' || - sourceType.value == 'up_archive') { - isWatchLaterVisible.value = !isWatchLaterVisible.value; + if (['watchLater', 'fav', 'up_archive'].contains(sourceType.value)) { + isWatchLaterVisible.value = val; } } diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index c7896480..cad795fc 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -206,12 +206,12 @@ class _VideoDetailPageState extends State vdCtr.bottomList.insert(3, BottomControlType.episode); } } + vdCtr.toggeleWatchLaterVisible(false); } else { if (vdCtr.bottomList.contains(BottomControlType.episode)) { vdCtr.bottomList.removeAt(3); } } - vdCtr.toggeleWatchLaterVisible(!isFullScreen); }); } @@ -825,9 +825,8 @@ class _VideoDetailPageState extends State /// 稍后再看列表 Obx( () => Visibility( - visible: vdCtr.sourceType.value == 'watchLater' || - vdCtr.sourceType.value == 'fav' || - vdCtr.sourceType.value == 'up_archive', + visible: ['watchLater', 'fav', 'up_archive'] + .contains(vdCtr.sourceType.value), child: AnimatedPositioned( duration: const Duration(milliseconds: 400), curve: Curves.easeInOut,