Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-03 17:22:05 +08:00
parent cb52840bad
commit b7f70ee0b3
4 changed files with 27 additions and 41 deletions

View File

@@ -124,10 +124,8 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
} }
if (videoDetailController.showReply) { if (videoDetailController.showReply) {
try { try {
final videoReplyController = Get.find<VideoReplyController>( Get.find<VideoReplyController>(tag: heroTag).count.value =
tag: heroTag, data.stat?.reply ?? 0;
);
videoReplyController.count.value = data.stat?.reply ?? 0;
} catch (_) {} } catch (_) {}
} }
} catch (_) {} } catch (_) {}

View File

@@ -129,8 +129,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
SizedBox( SizedBox(
height: 35, height: 35,
child: TextButton.icon( child: TextButton.icon(
onPressed: () => onPressed: _videoReplyController.queryBySort,
_videoReplyController.queryBySort(),
icon: Icon( icon: Icon(
Icons.sort, Icons.sort,
size: 16, size: 16,

View File

@@ -948,10 +948,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Column( body: Column(
children: [ children: [
buildTabbar( buildTabbar(onTap: videoDetailController.animToTop),
showReply: videoDetailController.showReply,
onTap: videoDetailController.animToTop,
),
Expanded( Expanded(
child: videoTabBarView( child: videoTabBarView(
controller: videoDetailController.tabCtr, controller: videoDetailController.tabCtr,
@@ -977,7 +974,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
final double width = size.width; final double width = size.width;
final double height = size.height; final double height = size.height;
final padding = MediaQuery.paddingOf(context); final padding = MediaQuery.paddingOf(context);
if (enableVerticalExpand && videoDetailController.isVertical.value) { if (videoDetailController.isVertical.value && enableVerticalExpand) {
final double videoHeight = final double videoHeight =
height - (removeSafeArea ? 0 : padding.vertical); height - (removeSafeArea ? 0 : padding.vertical);
final double videoWidth = videoHeight * 9 / 16; final double videoWidth = videoHeight * 9 / 16;
@@ -996,7 +993,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Column( body: Column(
children: [ children: [
buildTabbar(showReply: videoDetailController.showReply), buildTabbar(),
Expanded( Expanded(
child: videoTabBarView( child: videoTabBarView(
controller: videoDetailController.tabCtr, controller: videoDetailController.tabCtr,
@@ -1032,10 +1029,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Column( body: Column(
children: [ children: [
buildTabbar( buildTabbar(needIndicator: false),
needIndicator: false,
showReply: videoDetailController.showReply,
),
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
@@ -1062,7 +1056,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
final double width = size.width; final double width = size.width;
final double height = size.height; final double height = size.height;
final padding = MediaQuery.paddingOf(context); 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 videoHeight = height - (removeSafeArea ? 0 : padding.top);
final double videoWidth = videoHeight * 9 / 16; final double videoWidth = videoHeight * 9 / 16;
return Row( return Row(
@@ -1082,10 +1076,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Column( body: Column(
children: [ children: [
buildTabbar( buildTabbar(showIntro: false),
showIntro: false,
showReply: videoDetailController.showReply,
),
Expanded( Expanded(
child: videoTabBarView( child: videoTabBarView(
controller: videoDetailController.tabCtr, controller: videoDetailController.tabCtr,
@@ -1149,7 +1140,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
videoDetailController videoDetailController
.plPlayerController .plPlayerController
.showRelatedVideo, .showRelatedVideo,
showReply: videoDetailController.showReply,
), ),
Expanded( Expanded(
child: videoTabBarView( child: videoTabBarView(
@@ -1474,12 +1464,11 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
bool needIndicator = true, bool needIndicator = true,
String introText = '简介', String introText = '简介',
bool showIntro = true, bool showIntro = true,
bool showReply = true,
VoidCallback? onTap, VoidCallback? onTap,
}) { }) {
List<String> tabs = [ List<String> tabs = [
if (showIntro) introText, if (showIntro) introText,
if (showReply) '评论', if (videoDetailController.showReply) '评论',
if (_shouldShowSeasonPanel) '播放列表', if (_shouldShowSeasonPanel) '播放列表',
]; ];
if (videoDetailController.tabCtr.length != tabs.length) { if (videoDetailController.tabCtr.length != tabs.length) {
@@ -1493,13 +1482,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
); );
} }
final flag = !needIndicator || tabs.length == 1;
Widget tabbar() => TabBar( Widget tabbar() => TabBar(
labelColor: !needIndicator || tabs.length == 1 labelColor: flag ? themeData.colorScheme.onSurface : null,
? themeData.colorScheme.onSurface indicator: flag ? const BoxDecoration() : null,
: null,
indicator: !needIndicator || tabs.length == 1
? const BoxDecoration()
: null,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
controller: videoDetailController.tabCtr, controller: videoDetailController.tabCtr,
labelStyle: labelStyle:
@@ -1522,7 +1508,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
} }
} }
if (!needIndicator || tabs.length == 1) { if (flag) {
animToTop(); animToTop();
} else if (!videoDetailController.tabCtr.indexIsChanging) { } else if (!videoDetailController.tabCtr.indexIsChanging) {
animToTop(); animToTop();
@@ -1530,10 +1516,12 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
}, },
tabs: tabs.map((text) { tabs: tabs.map((text) {
if (text == '评论') { if (text == '评论') {
return Tab( return Obx(() {
text: final count = _videoReplyController.count.value;
'评论${_videoReplyController.count.value == -1 ? '' : ' ${NumUtil.numFormat(_videoReplyController.count.value)}'}', return Tab(
); text: '评论${count == -1 ? '' : ' ${NumUtil.numFormat(count)}'}',
);
});
} else { } else {
return Tab(text: text); return Tab(text: text);
} }
@@ -1558,7 +1546,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
else else
Flexible( Flexible(
flex: tabs.length == 3 ? 2 : 1, flex: tabs.length == 3 ? 2 : 1,
child: showReply ? Obx(() => tabbar()) : tabbar(), child: tabbar(),
), ),
Flexible( Flexible(
flex: 1, flex: 1,
@@ -1643,11 +1631,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
Obx(() { Obx(() {
if (videoDetailController.isShowCover.value) { if (videoDetailController.isShowCover.value) {
return Positioned( return Positioned.fill(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: GestureDetector( child: GestureDetector(
onTap: handlePlay, onTap: handlePlay,
child: Obx( child: Obx(

View File

@@ -10,6 +10,7 @@ import 'package:PiliPlus/models/user/stat.dart';
import 'package:PiliPlus/pages/dynamics/controller.dart'; import 'package:PiliPlus/pages/dynamics/controller.dart';
import 'package:PiliPlus/pages/dynamics_tab/controller.dart'; import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
import 'package:PiliPlus/pages/live/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/mine/controller.dart';
import 'package:PiliPlus/pages/pgc/controller.dart'; import 'package:PiliPlus/pages/pgc/controller.dart';
import 'package:PiliPlus/services/account_service.dart'; import 'package:PiliPlus/services/account_service.dart';
@@ -112,6 +113,10 @@ class LoginUtils {
GStorage.userInfo.delete('userInfoCache'), GStorage.userInfo.delete('userInfoCache'),
]); ]);
try {
Get.find<MainController>().setDynCount();
} catch (_) {}
try { try {
Get.find<MineController>() Get.find<MineController>()
..userInfo.value = UserInfoData() ..userInfo.value = UserInfoData()