mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
@@ -32,7 +32,7 @@ class MemberHome extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MemberHomeState extends State<MemberHome>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
with AutomaticKeepAliveClientMixin, GridMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@@ -44,6 +44,29 @@ class _MemberHomeState extends State<MemberHome>
|
||||
return _buildBody(_ctr.loadingState.value);
|
||||
}
|
||||
|
||||
late final gridDelegateV = SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(context).scale(55),
|
||||
);
|
||||
|
||||
late final gridDelegateAudio = SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: 2,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
childAspectRatio: StyleString.aspectRatio * 2.6,
|
||||
minHeight: MediaQuery.textScalerOf(context).scale(90),
|
||||
);
|
||||
|
||||
late final gridDelegatePgc = SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth / 3 * 2,
|
||||
childAspectRatio: 0.75,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(context).scale(52),
|
||||
);
|
||||
|
||||
Widget _buildBody(LoadingState<SpaceData?> loadingState) {
|
||||
final isVertical = context.isPortrait;
|
||||
final setting = _ctr.spaceSetting;
|
||||
@@ -67,26 +90,16 @@ class _MemberHomeState extends State<MemberHome>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: StyleString.safeSpace,
|
||||
),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(
|
||||
context,
|
||||
).scale(55),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem: res.archive!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(
|
||||
isVertical ? 4 : 8,
|
||||
res.archive!.item!.length,
|
||||
),
|
||||
sliver: SliverGrid.builder(
|
||||
gridDelegate: gridDelegateV,
|
||||
itemBuilder: (context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem: res.archive!.item![index],
|
||||
);
|
||||
},
|
||||
itemCount: min(
|
||||
isVertical ? 4 : 8,
|
||||
res.archive!.item!.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -120,26 +133,16 @@ class _MemberHomeState extends State<MemberHome>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: StyleString.safeSpace,
|
||||
),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(
|
||||
context,
|
||||
).scale(55),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem: res.coinArchive!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(
|
||||
isVertical ? 2 : 4,
|
||||
res.coinArchive!.item!.length,
|
||||
),
|
||||
sliver: SliverGrid.builder(
|
||||
gridDelegate: gridDelegateV,
|
||||
itemBuilder: (context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem: res.coinArchive!.item![index],
|
||||
);
|
||||
},
|
||||
itemCount: min(
|
||||
isVertical ? 2 : 4,
|
||||
res.coinArchive!.item!.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -156,26 +159,16 @@ class _MemberHomeState extends State<MemberHome>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: StyleString.safeSpace,
|
||||
),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(
|
||||
context,
|
||||
).scale(55),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem: res.likeArchive!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(
|
||||
isVertical ? 2 : 4,
|
||||
res.likeArchive!.item!.length,
|
||||
),
|
||||
sliver: SliverGrid.builder(
|
||||
gridDelegate: gridDelegateV,
|
||||
itemBuilder: (context, index) {
|
||||
return VideoCardVMemberHome(
|
||||
videoItem: res.likeArchive!.item![index],
|
||||
);
|
||||
},
|
||||
itemCount: min(
|
||||
isVertical ? 2 : 4,
|
||||
res.likeArchive!.item!.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -188,16 +181,14 @@ class _MemberHomeState extends State<MemberHome>
|
||||
param1: 'opus',
|
||||
count: res.article!.count!,
|
||||
),
|
||||
SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return MemberArticleItem(
|
||||
item: res.article!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: isVertical ? 1 : res.article!.item!.length,
|
||||
),
|
||||
SliverGrid.builder(
|
||||
gridDelegate: gridDelegate,
|
||||
itemBuilder: (context, index) {
|
||||
return MemberArticleItem(
|
||||
item: res.article!.item![index],
|
||||
);
|
||||
},
|
||||
itemCount: isVertical ? 1 : res.article!.item!.length,
|
||||
),
|
||||
],
|
||||
if (res.audios?.item?.isNotEmpty == true) ...[
|
||||
@@ -208,21 +199,14 @@ class _MemberHomeState extends State<MemberHome>
|
||||
param1: 'audio',
|
||||
count: res.audios!.count!,
|
||||
),
|
||||
SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: 2,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
childAspectRatio: StyleString.aspectRatio * 2.6,
|
||||
minHeight: MediaQuery.textScalerOf(context).scale(90),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return MemberAudioItem(
|
||||
item: res.audios!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: isVertical ? 1 : min(2, res.audios!.count!),
|
||||
),
|
||||
SliverGrid.builder(
|
||||
gridDelegate: gridDelegateAudio,
|
||||
itemBuilder: (context, index) {
|
||||
return MemberAudioItem(
|
||||
item: res.audios!.item![index],
|
||||
);
|
||||
},
|
||||
itemCount: isVertical ? 1 : min(2, res.audios!.count!),
|
||||
),
|
||||
],
|
||||
if (res.comic?.item?.isNotEmpty == true) ...[
|
||||
@@ -233,14 +217,12 @@ class _MemberHomeState extends State<MemberHome>
|
||||
param1: 'comic',
|
||||
count: res.comic!.count!,
|
||||
),
|
||||
SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return MemberComicItem(item: res.comic!.item![index]);
|
||||
},
|
||||
childCount: isVertical ? 1 : min(2, res.comic!.count!),
|
||||
),
|
||||
SliverGrid.builder(
|
||||
gridDelegate: gridDelegate,
|
||||
itemBuilder: (context, index) {
|
||||
return MemberComicItem(item: res.comic!.item![index]);
|
||||
},
|
||||
itemCount: isVertical ? 1 : min(2, res.comic!.count!),
|
||||
),
|
||||
],
|
||||
if (res.season?.item?.isNotEmpty == true) ...[
|
||||
@@ -255,26 +237,16 @@ class _MemberHomeState extends State<MemberHome>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: StyleString.safeSpace,
|
||||
),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth / 3 * 2,
|
||||
childAspectRatio: 0.75,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(
|
||||
context,
|
||||
).scale(52),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return PgcCardVMemberPgc(
|
||||
item: res.season!.item![index],
|
||||
);
|
||||
},
|
||||
childCount: min(
|
||||
isVertical ? 3 : 6,
|
||||
res.season!.item!.length,
|
||||
),
|
||||
sliver: SliverGrid.builder(
|
||||
gridDelegate: gridDelegatePgc,
|
||||
itemBuilder: (context, index) {
|
||||
return PgcCardVMemberPgc(
|
||||
item: res.season!.item![index],
|
||||
);
|
||||
},
|
||||
itemCount: min(
|
||||
isVertical ? 3 : 6,
|
||||
res.season!.item!.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user