mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 16:48:16 +08:00
fix: member contribute page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -77,57 +77,54 @@ 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) {
|
|
||||||
'video' => MemberVideo(
|
|
||||||
type: ContributeType.video,
|
|
||||||
heroTag: widget.heroTag,
|
|
||||||
mid: widget.mid,
|
|
||||||
title: item.title,
|
|
||||||
),
|
|
||||||
'charging_video' => MemberVideo(
|
|
||||||
type: ContributeType.charging,
|
|
||||||
heroTag: widget.heroTag,
|
|
||||||
mid: widget.mid,
|
|
||||||
title: item.title,
|
|
||||||
),
|
|
||||||
'article' => MemberArticle(
|
|
||||||
heroTag: widget.heroTag,
|
|
||||||
mid: widget.mid,
|
|
||||||
),
|
|
||||||
'audio' => MemberAudio(heroTag: widget.heroTag),
|
|
||||||
'season_video' => MemberVideo(
|
|
||||||
type: ContributeType.season,
|
|
||||||
heroTag: widget.heroTag,
|
|
||||||
mid: widget.mid,
|
|
||||||
seasonId: item.seasonId,
|
|
||||||
title: item.title,
|
|
||||||
),
|
|
||||||
'series' => MemberVideo(
|
|
||||||
type: ContributeType.series,
|
|
||||||
heroTag: widget.heroTag,
|
|
||||||
mid: widget.mid,
|
|
||||||
seriesId: item.seriesId,
|
|
||||||
title: item.title,
|
|
||||||
),
|
|
||||||
'ugcSeason' => SeasonSeriesPage(
|
|
||||||
mid: widget.mid,
|
|
||||||
heroTag: widget.heroTag,
|
|
||||||
),
|
|
||||||
_ => Center(child: Text(item.title!))
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: MemberVideo(
|
: _controller.items?.isNotEmpty == true
|
||||||
type: ContributeType.video,
|
? _getPageFromType(_controller.items!.first)
|
||||||
heroTag: widget.heroTag,
|
: const SizedBox.shrink();
|
||||||
mid: widget.mid,
|
}
|
||||||
title: '视频',
|
|
||||||
);
|
Widget _getPageFromType(item) {
|
||||||
|
return switch (item.param) {
|
||||||
|
'video' => MemberVideo(
|
||||||
|
type: ContributeType.video,
|
||||||
|
heroTag: widget.heroTag,
|
||||||
|
mid: widget.mid,
|
||||||
|
title: item.title,
|
||||||
|
),
|
||||||
|
'charging_video' => MemberVideo(
|
||||||
|
type: ContributeType.charging,
|
||||||
|
heroTag: widget.heroTag,
|
||||||
|
mid: widget.mid,
|
||||||
|
title: item.title,
|
||||||
|
),
|
||||||
|
'article' => MemberArticle(
|
||||||
|
heroTag: widget.heroTag,
|
||||||
|
mid: widget.mid,
|
||||||
|
),
|
||||||
|
'audio' => MemberAudio(heroTag: widget.heroTag),
|
||||||
|
'season_video' => MemberVideo(
|
||||||
|
type: ContributeType.season,
|
||||||
|
heroTag: widget.heroTag,
|
||||||
|
mid: widget.mid,
|
||||||
|
seasonId: item.seasonId,
|
||||||
|
title: item.title,
|
||||||
|
),
|
||||||
|
'series' => MemberVideo(
|
||||||
|
type: ContributeType.series,
|
||||||
|
heroTag: widget.heroTag,
|
||||||
|
mid: widget.mid,
|
||||||
|
seriesId: item.seriesId,
|
||||||
|
title: item.title,
|
||||||
|
),
|
||||||
|
'ugcSeason' => SeasonSeriesPage(
|
||||||
|
mid: widget.mid,
|
||||||
|
heroTag: widget.heroTag,
|
||||||
|
),
|
||||||
|
_ => Center(child: Text(item.title!))
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,36 +29,25 @@ 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 =
|
// show if exist
|
||||||
// items!.where((item) => item.param == 'season_video').length;
|
if (_ctr.hasSeasonOrSeries == true) {
|
||||||
// if (currentSeasonCount < _ctr.ugcSeasonCount!) {
|
items!.add(
|
||||||
// items!.add(
|
Item(
|
||||||
// Item(
|
param: 'ugcSeason',
|
||||||
// param: 'ugcSeason',
|
title: '全部合集/列表',
|
||||||
// title: '全部合集/列表',
|
),
|
||||||
// ),
|
);
|
||||||
// );
|
}
|
||||||
// }
|
tabs = items!.map((item) => Tab(text: item.title)).toList();
|
||||||
// }
|
tabController = TabController(
|
||||||
// show if exist
|
vsync: this,
|
||||||
if (_ctr.hasSeasonOrSeries == true) {
|
length: items!.length,
|
||||||
items!.add(
|
initialIndex: max(0, initialIndex ?? 0),
|
||||||
Item(
|
|
||||||
param: 'ugcSeason',
|
|
||||||
title: '全部合集/列表',
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
tabs = items!.map((item) => Tab(text: item.title)).toList();
|
|
||||||
tabController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: items!.length,
|
|
||||||
initialIndex: max(0, initialIndex ?? 0),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user