Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-23 16:47:11 +08:00
parent 148e0872b4
commit 418a1e8d39
821 changed files with 29467 additions and 25520 deletions

View File

@@ -74,7 +74,9 @@ class MemberVideoCtr
@override
bool customHandleResponse(
bool isRefresh, Success<SpaceArchiveData> response) {
bool isRefresh,
Success<SpaceArchiveData> response,
) {
SpaceArchiveData data = response.response;
episodicButton
..value = data.episodicButton ?? EpisodicButton()
@@ -116,14 +118,14 @@ class MemberVideoCtr
mid: mid,
aid: type == ContributeType.video
? isLoadPrevious == true
? firstAid
: lastAid
? firstAid
: lastAid
: null,
order: type == ContributeType.video ? order.value : null,
sort: type == ContributeType.video
? isLoadPrevious == true
? 'asc'
: null
? 'asc'
: null
: sort.value,
pn: type == ContributeType.charging ? page : null,
next: next,
@@ -184,7 +186,8 @@ class MemberVideoCtr
SmartDialog.showToast('已跳过不支持播放的视频');
}
bool desc = seasonId != null ? false : true;
desc = (seasonId != null || seriesId != null) &&
desc =
(seasonId != null || seriesId != null) &&
(type == ContributeType.video
? order.value == 'click'
: sort.value == 'asc')
@@ -202,8 +205,9 @@ class MemberVideoCtr
'$username: ${title ?? episodicButton.text ?? '播放全部'}',
if (seriesId == null) 'count': count.value,
if (seasonId != null || seriesId != null)
'mediaType':
Uri.parse(episodicButton.uri!).queryParameters['page_type'],
'mediaType': Uri.parse(
episodicButton.uri!,
).queryParameters['page_type'],
'desc': desc,
if (type == ContributeType.video)
'sortField': order.value == 'click' ? 2 : 1,

View File

@@ -72,7 +72,8 @@ class _MemberVideoState extends State<MemberVideo>
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
sliver: Obx(
() => _buildBody(theme, _controller.loadingState.value)),
() => _buildBody(theme, _controller.loadingState.value),
),
),
],
),
@@ -105,135 +106,141 @@ class _MemberVideoState extends State<MemberVideo>
}
Widget _buildBody(
ThemeData theme, LoadingState<List<SpaceArchiveItem>?> loadingState) {
ThemeData theme,
LoadingState<List<SpaceArchiveItem>?> loadingState,
) {
return switch (loadingState) {
Loading() => SliverPadding(
padding:
widget.isSingle ? const EdgeInsets.only(top: 7) : EdgeInsets.zero,
sliver: SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
return const VideoCardHSkeleton();
},
childCount: 10,
),
padding: widget.isSingle
? const EdgeInsets.only(top: 7)
: EdgeInsets.zero,
sliver: SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
return const VideoCardHSkeleton();
},
childCount: 10,
),
),
Success(:var response) => response?.isNotEmpty == true
? SliverMainAxisGroup(
slivers: [
SliverPersistentHeader(
pinned: false,
floating: true,
delegate: CustomSliverPersistentHeaderDelegate(
extent: 40,
bgColor: theme.colorScheme.surface,
child: SizedBox(
height: 40,
child: Row(
children: [
const SizedBox(width: 8),
Padding(
padding: const EdgeInsets.only(left: 6),
child: Obx(
() {
final count = _controller.count.value;
return Text(
count != -1 ? '$count视频' : '',
style: const TextStyle(fontSize: 13),
);
},
),
Success(:var response) =>
response?.isNotEmpty == true
? SliverMainAxisGroup(
slivers: [
SliverPersistentHeader(
pinned: false,
floating: true,
delegate: CustomSliverPersistentHeaderDelegate(
extent: 40,
bgColor: theme.colorScheme.surface,
child: SizedBox(
height: 40,
child: Row(
children: [
const SizedBox(width: 8),
Padding(
padding: const EdgeInsets.only(left: 6),
child: Obx(
() {
final count = _controller.count.value;
return Text(
count != -1 ? '$count视频' : '',
style: const TextStyle(fontSize: 13),
);
},
),
),
),
Obx(
() {
final episodicButton =
_controller.episodicButton.value;
return episodicButton.uri?.isNotEmpty == true
? Container(
height: 35,
padding: EdgeInsets.only(
Obx(
() {
final episodicButton =
_controller.episodicButton.value;
return episodicButton.uri?.isNotEmpty == true
? Container(
height: 35,
padding: EdgeInsets.only(
left: _controller.count.value != -1
? 6
: 0),
child: TextButton.icon(
onPressed: _controller.toViewPlayAll,
icon: Icon(
Icons.play_circle_outline_rounded,
size: 16,
color: theme.colorScheme.secondary,
: 0,
),
label: Text(
episodicButton.text ?? '播放全部',
style: TextStyle(
fontSize: 13,
child: TextButton.icon(
onPressed: _controller.toViewPlayAll,
icon: Icon(
Icons.play_circle_outline_rounded,
size: 16,
color: theme.colorScheme.secondary,
),
label: Text(
episodicButton.text ?? '播放全部',
style: TextStyle(
fontSize: 13,
color:
theme.colorScheme.secondary,
),
),
),
),
)
: const SizedBox.shrink();
},
),
const Spacer(),
SizedBox(
height: 35,
child: TextButton.icon(
onPressed: _controller.queryBySort,
icon: Icon(
Icons.sort,
size: 16,
color: theme.colorScheme.secondary,
),
label: Obx(
() => Text(
widget.type == ContributeType.video
? _controller.order.value == 'pubdate'
? '新发布'
: '最多播放'
: _controller.sort.value == 'desc'
? '默认'
: '倒序',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.secondary,
)
: const SizedBox.shrink();
},
),
const Spacer(),
SizedBox(
height: 35,
child: TextButton.icon(
onPressed: _controller.queryBySort,
icon: Icon(
Icons.sort,
size: 16,
color: theme.colorScheme.secondary,
),
label: Obx(
() => Text(
widget.type == ContributeType.video
? _controller.order.value == 'pubdate'
? '最新发布'
: '多播放'
: _controller.sort.value == 'desc'
? '默认'
: '倒序',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.secondary,
),
),
),
),
),
),
const SizedBox(width: 8),
],
const SizedBox(width: 8),
],
),
),
),
),
),
SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (widget.type != ContributeType.season &&
index == response.length - 1) {
_controller.onLoadMore();
}
return VideoCardHMemberVideo(
videoItem: response[index],
fromViewAid: _controller.fromViewAid,
);
},
childCount: response!.length,
SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (widget.type != ContributeType.season &&
index == response.length - 1) {
_controller.onLoadMore();
}
return VideoCardHMemberVideo(
videoItem: response[index],
fromViewAid: _controller.fromViewAid,
);
},
childCount: response!.length,
),
),
),
],
)
: HttpError(
onReload: _controller.onReload,
),
],
)
: HttpError(
onReload: _controller.onReload,
),
Error(:var errMsg) => HttpError(
errMsg: errMsg,
onReload: _controller.onReload,
),
errMsg: errMsg,
onReload: _controller.onReload,
),
};
}
}

View File

@@ -43,7 +43,8 @@ class VideoCardHMemberVideo extends StatelessWidget {
cover: videoItem.cover,
bvid: videoItem.bvid,
),
onTap: onTap ??
onTap:
onTap ??
() async {
if (videoItem.isPgc == true &&
videoItem.uri?.isNotEmpty == true) {
@@ -78,96 +79,113 @@ class VideoCardHMemberVideo extends StatelessWidget {
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: videoItem.cover,
width: maxWidth,
height: maxHeight,
),
if (fromViewAid == videoItem.param)
const Positioned.fill(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: StyleString.mdRadius,
color: Colors.black54,
),
child: Center(
child: Text(
'上次观看',
style: TextStyle(
color: Colors.white,
fontSize: 15,
letterSpacing: 5,
builder:
(
BuildContext context,
BoxConstraints boxConstraints,
) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight =
boxConstraints.maxHeight;
return Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: videoItem.cover,
width: maxWidth,
height: maxHeight,
),
if (fromViewAid == videoItem.param)
const Positioned.fill(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: StyleString.mdRadius,
color: Colors.black54,
),
child: Center(
child: Text(
'上次观看',
style: TextStyle(
color: Colors.white,
fontSize: 15,
letterSpacing: 5,
),
),
),
),
),
),
),
if (videoItem.badges?.isNotEmpty == true)
PBadge(
text: videoItem.badges!
.map((item) => item.text)
.join('|'),
right: 6.0,
top: 6.0,
type: videoItem.badges!.first.text == '充电专属'
? PBadgeType.error
: PBadgeType.primary,
),
if (videoItem.history != null) ...[
Builder(builder: (context) {
try {
return Positioned(
left: 0,
right: 0,
bottom: 0,
child: videoProgressIndicator(
videoItem.history!.progress! /
videoItem.history!.duration!,
),
);
} catch (_) {
return const SizedBox.shrink();
}
}),
Builder(builder: (context) {
try {
return PBadge(
text: videoItem.history!.progress ==
videoItem.history!.duration
? '已看完'
: '${DurationUtil.formatDuration(videoItem.history!.progress)}/${DurationUtil.formatDuration(videoItem.history!.duration)}',
if (videoItem.badges?.isNotEmpty == true)
PBadge(
text: videoItem.badges!
.map((item) => item.text)
.join('|'),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
);
} catch (_) {
return PBadge(
top: 6.0,
type:
videoItem.badges!.first.text ==
'充电专属'
? PBadgeType.error
: PBadgeType.primary,
),
if (videoItem.history != null) ...[
Builder(
builder: (context) {
try {
return Positioned(
left: 0,
right: 0,
bottom: 0,
child: videoProgressIndicator(
videoItem.history!.progress! /
videoItem
.history!
.duration!,
),
);
} catch (_) {
return const SizedBox.shrink();
}
},
),
Builder(
builder: (context) {
try {
return PBadge(
text:
videoItem.history!.progress ==
videoItem
.history!
.duration
? '已看完'
: '${DurationUtil.formatDuration(videoItem.history!.progress)}/${DurationUtil.formatDuration(videoItem.history!.duration)}',
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
);
} catch (_) {
return PBadge(
text: DurationUtil.formatDuration(
videoItem.duration,
),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
);
}
},
),
] else if (videoItem.duration > 0)
PBadge(
text: DurationUtil.formatDuration(
videoItem.duration),
videoItem.duration,
),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
);
}
}),
] else if (videoItem.duration > 0)
PBadge(
text: DurationUtil.formatDuration(
videoItem.duration),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
),
],
);
},
),
],
);
},
),
),
const SizedBox(width: 10),
@@ -193,7 +211,8 @@ class VideoCardHMemberVideo extends StatelessWidget {
}
Widget content(BuildContext context, ThemeData theme) {
final isCurr = fromViewAid == videoItem.param ||
final isCurr =
fromViewAid == videoItem.param ||
(videoItem.bvid != null && videoItem.bvid == bvid);
return Expanded(
child: Column(