fix: member contribute page

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-16 19:49:39 +08:00
parent 7043fdc35d
commit 980733ba22
2 changed files with 61 additions and 75 deletions

View File

@@ -77,9 +77,18 @@ class _MemberContributeState extends State<MemberContribute>
child: TabBarView( child: TabBarView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
controller: _controller.tabController, controller: _controller.tabController,
children: _controller.items! children: _controller.items!.map(_getPageFromType).toList(),
.map( ),
(item) => switch (item.param) { ),
],
)
: _controller.items?.isNotEmpty == true
? _getPageFromType(_controller.items!.first)
: const SizedBox.shrink();
}
Widget _getPageFromType(item) {
return switch (item.param) {
'video' => MemberVideo( 'video' => MemberVideo(
type: ContributeType.video, type: ContributeType.video,
heroTag: widget.heroTag, heroTag: widget.heroTag,
@@ -116,18 +125,6 @@ class _MemberContributeState extends State<MemberContribute>
heroTag: widget.heroTag, heroTag: widget.heroTag,
), ),
_ => Center(child: Text(item.title!)) _ => Center(child: Text(item.title!))
}, };
)
.toList(),
),
),
],
)
: MemberVideo(
type: ContributeType.video,
heroTag: widget.heroTag,
mid: widget.mid,
title: '视频',
);
} }
} }

View File

@@ -29,21 +29,9 @@ class MemberContributeCtr extends CommonController
super.onInit(); super.onInit();
Tab2 contribute = Tab2 contribute =
_ctr.tab2!.firstWhere((item) => item.param == 'contribute'); _ctr.tab2!.firstWhere((item) => item.param == 'contribute');
if (contribute.items?.isNullOrEmpty == false && if (contribute.items?.isNullOrEmpty == false) {
contribute.items!.length > 1) {
items = contribute.items; items = contribute.items;
// if (_ctr.ugcSeasonCount != null) { if (contribute.items!.length > 1) {
// int currentSeasonCount =
// items!.where((item) => item.param == 'season_video').length;
// if (currentSeasonCount < _ctr.ugcSeasonCount!) {
// items!.add(
// Item(
// param: 'ugcSeason',
// title: '全部合集/列表',
// ),
// );
// }
// }
// show if exist // show if exist
if (_ctr.hasSeasonOrSeries == true) { if (_ctr.hasSeasonOrSeries == true) {
items!.add( items!.add(
@@ -61,6 +49,7 @@ class MemberContributeCtr extends CommonController
); );
} }
} }
}
@override @override
Future<LoadingState> customGetData() { Future<LoadingState> customGetData() {