diff --git a/lib/pages/video/introduction/ugc/controller.dart b/lib/pages/video/introduction/ugc/controller.dart index 3b074f7c..4b3ac7db 100644 --- a/lib/pages/video/introduction/ugc/controller.dart +++ b/lib/pages/video/introduction/ugc/controller.dart @@ -124,10 +124,8 @@ class UgcIntroController extends CommonIntroController with ReloadMixin { } if (videoDetailController.showReply) { try { - final videoReplyController = Get.find( - tag: heroTag, - ); - videoReplyController.count.value = data.stat?.reply ?? 0; + Get.find(tag: heroTag).count.value = + data.stat?.reply ?? 0; } catch (_) {} } } catch (_) {} diff --git a/lib/pages/video/reply/view.dart b/lib/pages/video/reply/view.dart index 2b46e6ab..840a385d 100644 --- a/lib/pages/video/reply/view.dart +++ b/lib/pages/video/reply/view.dart @@ -129,8 +129,7 @@ class _VideoReplyPanelState extends State SizedBox( height: 35, child: TextButton.icon( - onPressed: () => - _videoReplyController.queryBySort(), + onPressed: _videoReplyController.queryBySort, icon: Icon( Icons.sort, size: 16, diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index 6857efec..9c0ddf8c 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -948,10 +948,7 @@ class _VideoDetailPageVState extends State backgroundColor: Colors.transparent, body: Column( children: [ - buildTabbar( - showReply: videoDetailController.showReply, - onTap: videoDetailController.animToTop, - ), + buildTabbar(onTap: videoDetailController.animToTop), Expanded( child: videoTabBarView( controller: videoDetailController.tabCtr, @@ -977,7 +974,7 @@ class _VideoDetailPageVState extends State final double width = size.width; final double height = size.height; final padding = MediaQuery.paddingOf(context); - if (enableVerticalExpand && videoDetailController.isVertical.value) { + if (videoDetailController.isVertical.value && enableVerticalExpand) { final double videoHeight = height - (removeSafeArea ? 0 : padding.vertical); final double videoWidth = videoHeight * 9 / 16; @@ -996,7 +993,7 @@ class _VideoDetailPageVState extends State backgroundColor: Colors.transparent, body: Column( children: [ - buildTabbar(showReply: videoDetailController.showReply), + buildTabbar(), Expanded( child: videoTabBarView( controller: videoDetailController.tabCtr, @@ -1032,10 +1029,7 @@ class _VideoDetailPageVState extends State backgroundColor: Colors.transparent, body: Column( children: [ - buildTabbar( - needIndicator: false, - showReply: videoDetailController.showReply, - ), + buildTabbar(needIndicator: false), Expanded( child: Row( children: [ @@ -1062,7 +1056,7 @@ class _VideoDetailPageVState extends State final double width = size.width; final double height = size.height; final padding = MediaQuery.paddingOf(context); - if (enableVerticalExpand && videoDetailController.isVertical.value) { + if (videoDetailController.isVertical.value && enableVerticalExpand) { final double videoHeight = height - (removeSafeArea ? 0 : padding.top); final double videoWidth = videoHeight * 9 / 16; return Row( @@ -1082,10 +1076,7 @@ class _VideoDetailPageVState extends State backgroundColor: Colors.transparent, body: Column( children: [ - buildTabbar( - showIntro: false, - showReply: videoDetailController.showReply, - ), + buildTabbar(showIntro: false), Expanded( child: videoTabBarView( controller: videoDetailController.tabCtr, @@ -1149,7 +1140,6 @@ class _VideoDetailPageVState extends State videoDetailController .plPlayerController .showRelatedVideo, - showReply: videoDetailController.showReply, ), Expanded( child: videoTabBarView( @@ -1474,12 +1464,11 @@ class _VideoDetailPageVState extends State bool needIndicator = true, String introText = '简介', bool showIntro = true, - bool showReply = true, VoidCallback? onTap, }) { List tabs = [ if (showIntro) introText, - if (showReply) '评论', + if (videoDetailController.showReply) '评论', if (_shouldShowSeasonPanel) '播放列表', ]; if (videoDetailController.tabCtr.length != tabs.length) { @@ -1493,13 +1482,10 @@ class _VideoDetailPageVState extends State ); } + final flag = !needIndicator || tabs.length == 1; Widget tabbar() => TabBar( - labelColor: !needIndicator || tabs.length == 1 - ? themeData.colorScheme.onSurface - : null, - indicator: !needIndicator || tabs.length == 1 - ? const BoxDecoration() - : null, + labelColor: flag ? themeData.colorScheme.onSurface : null, + indicator: flag ? const BoxDecoration() : null, padding: EdgeInsets.zero, controller: videoDetailController.tabCtr, labelStyle: @@ -1522,7 +1508,7 @@ class _VideoDetailPageVState extends State } } - if (!needIndicator || tabs.length == 1) { + if (flag) { animToTop(); } else if (!videoDetailController.tabCtr.indexIsChanging) { animToTop(); @@ -1530,10 +1516,12 @@ class _VideoDetailPageVState extends State }, tabs: tabs.map((text) { if (text == '评论') { - return Tab( - text: - '评论${_videoReplyController.count.value == -1 ? '' : ' ${NumUtil.numFormat(_videoReplyController.count.value)}'}', - ); + return Obx(() { + final count = _videoReplyController.count.value; + return Tab( + text: '评论${count == -1 ? '' : ' ${NumUtil.numFormat(count)}'}', + ); + }); } else { return Tab(text: text); } @@ -1558,7 +1546,7 @@ class _VideoDetailPageVState extends State else Flexible( flex: tabs.length == 3 ? 2 : 1, - child: showReply ? Obx(() => tabbar()) : tabbar(), + child: tabbar(), ), Flexible( flex: 1, @@ -1643,11 +1631,7 @@ class _VideoDetailPageVState extends State Obx(() { if (videoDetailController.isShowCover.value) { - return Positioned( - top: 0, - left: 0, - right: 0, - bottom: 0, + return Positioned.fill( child: GestureDetector( onTap: handlePlay, child: Obx( diff --git a/lib/utils/login_utils.dart b/lib/utils/login_utils.dart index afeb79d7..98647af6 100644 --- a/lib/utils/login_utils.dart +++ b/lib/utils/login_utils.dart @@ -10,6 +10,7 @@ import 'package:PiliPlus/models/user/stat.dart'; import 'package:PiliPlus/pages/dynamics/controller.dart'; import 'package:PiliPlus/pages/dynamics_tab/controller.dart'; import 'package:PiliPlus/pages/live/controller.dart'; +import 'package:PiliPlus/pages/main/controller.dart'; import 'package:PiliPlus/pages/mine/controller.dart'; import 'package:PiliPlus/pages/pgc/controller.dart'; import 'package:PiliPlus/services/account_service.dart'; @@ -112,6 +113,10 @@ class LoginUtils { GStorage.userInfo.delete('userInfoCache'), ]); + try { + Get.find().setDynCount(); + } catch (_) {} + try { Get.find() ..userInfo.value = UserInfoData()