refactor: subscription

opt: pages

Closes #58

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-28 10:15:09 +08:00
parent 51f87cc49c
commit de91bdff74
12 changed files with 448 additions and 443 deletions

View File

@@ -289,19 +289,23 @@ class _FavDetailPageState extends State<FavDetailPage> {
Widget _buildBody(LoadingState loadingState) {
return switch (loadingState) {
Loading() => SliverGrid(
gridDelegate: SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: StyleString.cardSpace,
crossAxisSpacing: StyleString.safeSpace,
maxCrossAxisExtent: Grid.maxRowWidth * 2,
childAspectRatio: StyleString.aspectRatio * 2.4,
mainAxisExtent: 0,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
return const VideoCardHSkeleton();
},
childCount: 10,
Loading() => SliverPadding(
padding:
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: StyleString.cardSpace,
crossAxisSpacing: StyleString.safeSpace,
maxCrossAxisExtent: Grid.maxRowWidth * 2,
childAspectRatio: StyleString.aspectRatio * 2.4,
mainAxisExtent: 0,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
return const VideoCardHSkeleton();
},
childCount: 10,
),
),
),
Success() => (loadingState.response as List?)?.isNotEmpty == true
@@ -356,9 +360,9 @@ class _FavDetailPageState extends State<FavDetailPage> {
},
),
Positioned(
top: 0,
top: 8,
left: 12,
bottom: 0,
bottom: 8,
child: IgnorePointer(
child: LayoutBuilder(
builder: (context, constraints) =>

View File

@@ -74,65 +74,63 @@ class FavVideoCardH extends StatelessWidget {
});
},
onLongPress: onLongPress,
child: Column(
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
child: LayoutBuilder(
builder: (context, boxConstraints) {
double width =
(boxConstraints.maxWidth - StyleString.cardSpace * 6) / 2;
return SizedBox(
height: width / StyleString.aspectRatio,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
double maxWidth = boxConstraints.maxWidth;
double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
Hero(
tag: heroTag,
child: NetworkImgLayer(
src: videoItem.pic,
width: maxWidth,
height: maxHeight,
),
),
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (videoItem.ogv != null) ...[
PBadge(
text: videoItem.ogv['type_name'],
top: 6.0,
right: 6.0,
bottom: null,
left: null,
),
],
],
);
},
),
),
videoContent(context)
],
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: StyleString.cardSpace,
),
child: LayoutBuilder(
builder: (context, boxConstraints) {
double width =
(boxConstraints.maxWidth - StyleString.cardSpace * 6) / 2;
return SizedBox(
height: width / StyleString.aspectRatio,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
double maxWidth = boxConstraints.maxWidth;
double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
Hero(
tag: heroTag,
child: NetworkImgLayer(
src: videoItem.pic,
width: maxWidth,
height: maxHeight,
),
),
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (videoItem.ogv != null) ...[
PBadge(
text: videoItem.ogv['type_name'],
top: 6.0,
right: 6.0,
bottom: null,
left: null,
),
],
],
);
},
),
),
);
},
),
),
],
videoContent(context)
],
),
);
},
),
),
);
}