mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
committed by
GitHub
parent
1da30d5d8f
commit
a915650bb6
@@ -40,20 +40,19 @@ class _MemberHomeState extends State<MemberHome>
|
||||
return _buildBody(_ctr.loadingState.value);
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState loadingState) {
|
||||
Widget _buildBody(LoadingState<SpaceData?> loadingState) {
|
||||
final isVertical = context.orientation == Orientation.portrait;
|
||||
return switch (loadingState) {
|
||||
Loading() => loadingWidget,
|
||||
Success() => loadingState.response is SpaceData
|
||||
Success(response: final res) => res != null
|
||||
? CustomScrollView(
|
||||
slivers: [
|
||||
if (loadingState.response?.archive?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.archive?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '视频',
|
||||
param: 'contribute',
|
||||
param1: 'video',
|
||||
count: loadingState.response.archive.count,
|
||||
count: res.archive!.count!,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -71,38 +70,35 @@ class _MemberHomeState extends State<MemberHome>
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem:
|
||||
loadingState.response.archive.item[index],
|
||||
videoItem: res.archive!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(isVertical ? 4 : 8,
|
||||
loadingState.response.archive.item.length),
|
||||
childCount:
|
||||
min(isVertical ? 4 : 8, res.archive!.item!.length),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (loadingState.response?.favourite2?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.favourite2?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '收藏',
|
||||
param: 'favorite',
|
||||
count: loadingState.response.favourite2.count,
|
||||
count: res.favourite2!.count!,
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 98,
|
||||
child: MemberFavItem(
|
||||
item: loadingState.response.favourite2.item.first,
|
||||
item: res.favourite2!.item!.first,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (loadingState.response?.coinArchive?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.coinArchive?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '最近投币的视频',
|
||||
param: 'coinArchive',
|
||||
count: loadingState.response.coinArchive.count,
|
||||
count: res.coinArchive!.count!,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -120,22 +116,20 @@ class _MemberHomeState extends State<MemberHome>
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem:
|
||||
loadingState.response.coinArchive.item[index],
|
||||
videoItem: res.coinArchive!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(isVertical ? 2 : 4,
|
||||
loadingState.response.coinArchive.item.length),
|
||||
childCount: min(
|
||||
isVertical ? 2 : 4, res.coinArchive!.item!.length),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (loadingState.response?.likeArchive?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.likeArchive?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '最近点赞的视频',
|
||||
param: 'likeArchive',
|
||||
count: loadingState.response.likeArchive.count,
|
||||
count: res.likeArchive!.count!,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -153,54 +147,48 @@ class _MemberHomeState extends State<MemberHome>
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem:
|
||||
loadingState.response.likeArchive.item[index],
|
||||
videoItem: res.likeArchive!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(isVertical ? 2 : 4,
|
||||
loadingState.response.likeArchive.item.length),
|
||||
childCount: min(
|
||||
isVertical ? 2 : 4, res.likeArchive!.item!.length),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (loadingState.response?.article?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.article?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '专栏',
|
||||
param: 'contribute',
|
||||
param1: 'article',
|
||||
count: loadingState.response.article.count,
|
||||
count: res.article!.count!,
|
||||
),
|
||||
SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return MemberArticleItem(
|
||||
item: loadingState.response.article.item[index],
|
||||
item: res.article!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: isVertical
|
||||
? 1
|
||||
: loadingState.response.article.item.length,
|
||||
childCount: isVertical ? 1 : res.article!.item!.length,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (loadingState.response?.audios?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.audios?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '音频',
|
||||
param: 'contribute',
|
||||
param1: 'audio',
|
||||
count: loadingState.response.audios.count,
|
||||
count: res.audios!.count!,
|
||||
),
|
||||
// TODO
|
||||
],
|
||||
if (loadingState.response?.season?.item?.isNotEmpty ==
|
||||
true) ...[
|
||||
if (res.season?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
title: '追番',
|
||||
param: 'bangumi',
|
||||
count: loadingState.response.season.count,
|
||||
count: res.season!.count!,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -218,12 +206,11 @@ class _MemberHomeState extends State<MemberHome>
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return BangumiCardVMemberHome(
|
||||
bangumiItem:
|
||||
loadingState.response.season.item[index],
|
||||
bangumiItem: res.season!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(isVertical ? 3 : 6,
|
||||
loadingState.response.season.item.length),
|
||||
childCount:
|
||||
min(isVertical ? 3 : 6, res.season!.item!.length),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user