opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-24 16:36:26 +08:00
parent 4d7d9abc60
commit c28729af5b
27 changed files with 266 additions and 310 deletions

View File

@@ -86,7 +86,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
@override
Widget build(BuildContext context) {
if (episodes.isEmpty) {
return const SizedBox();
return const SizedBox.shrink();
}
return Builder(builder: (BuildContext context) {
return Container(

View File

@@ -135,13 +135,11 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
Loading() => CustomScrollView(
physics: const NeverScrollableScrollPhysics(),
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return const VideoReplySkeleton();
},
childCount: 8,
),
SliverList.builder(
itemBuilder: (context, index) {
return const VideoReplySkeleton();
},
itemCount: 8,
)
],
),

View File

@@ -196,71 +196,67 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
Widget _buildBody(LoadingState loadingState) {
return switch (loadingState) {
Loading() => SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, index) {
return const VideoReplySkeleton();
},
childCount: 5,
),
Loading() => SliverList.builder(
itemBuilder: (BuildContext context, index) {
return const VideoReplySkeleton();
},
itemCount: 5,
),
Success() => loadingState.response?.isNotEmpty == true
? SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, index) {
double bottom = MediaQuery.of(context).padding.bottom;
if (index == loadingState.response.length) {
_videoReplyController.onLoadMore();
return Container(
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: bottom),
height: bottom + 100,
child: Text(
_videoReplyController.isEnd.not
? '加载中...'
: loadingState.response.isEmpty
? '没有评论'
: '没有更多了',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
),
? SliverList.builder(
itemBuilder: (context, index) {
double bottom = MediaQuery.of(context).padding.bottom;
if (index == loadingState.response.length) {
_videoReplyController.onLoadMore();
return Container(
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: bottom),
height: bottom + 100,
child: Text(
_videoReplyController.isEnd.not
? '加载中...'
: loadingState.response.isEmpty
? '还没有评论'
: '没有更多了',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
),
);
} else {
return ReplyItemGrpc(
replyItem: loadingState.response[index],
replyLevel: widget.replyLevel,
replyReply: widget.replyReply,
onReply: () {
_videoReplyController.onReply(
context,
replyItem: loadingState.response[index],
index: index,
);
},
onDelete: (subIndex) =>
_videoReplyController.onRemove(index, subIndex),
upMid: _videoReplyController.upMid,
getTag: () => heroTag,
onViewImage: widget.onViewImage,
onDismissed: widget.onDismissed,
callback: widget.callback,
onCheckReply: (item) =>
_videoReplyController.onCheckReply(context, item),
onToggleTop: (isUpTop, rpid) =>
_videoReplyController.onToggleTop(
index,
_videoReplyController.aid,
ReplyType.video.index,
isUpTop,
rpid,
),
);
}
},
childCount: loadingState.response.length + 1,
),
),
);
} else {
return ReplyItemGrpc(
replyItem: loadingState.response[index],
replyLevel: widget.replyLevel,
replyReply: widget.replyReply,
onReply: () {
_videoReplyController.onReply(
context,
replyItem: loadingState.response[index],
index: index,
);
},
onDelete: (subIndex) =>
_videoReplyController.onRemove(index, subIndex),
upMid: _videoReplyController.upMid,
getTag: () => heroTag,
onViewImage: widget.onViewImage,
onDismissed: widget.onDismissed,
callback: widget.callback,
onCheckReply: (item) =>
_videoReplyController.onCheckReply(context, item),
onToggleTop: (isUpTop, rpid) =>
_videoReplyController.onToggleTop(
index,
_videoReplyController.aid,
ReplyType.video.index,
isUpTop,
rpid,
),
);
}
},
itemCount: loadingState.response.length + 1,
)
: HttpError(
errMsg: '还没有评论',

View File

@@ -391,13 +391,11 @@ class _VideoReplyReplyPanelState
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return const VideoReplySkeleton();
},
childCount: 8,
),
SliverList.builder(
itemBuilder: (context, index) {
return const VideoReplySkeleton();
},
itemCount: 8,
)
],
),

View File

@@ -1226,7 +1226,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
Widget get childWhenEnabled => Obx(
() => !videoDetailController.autoPlay.value
? const SizedBox()
? const SizedBox.shrink()
: PLVideoPlayer(
key: Key(heroTag),
plPlayerController: plPlayerController!,

View File

@@ -782,7 +782,7 @@ class HeaderControlState extends State<HeaderControl> {
Icons.done,
color: Theme.of(context).colorScheme.primary,
)
: const SizedBox(),
: const SizedBox.shrink(),
),
]
],
@@ -858,7 +858,7 @@ class HeaderControlState extends State<HeaderControl> {
Icons.done,
color: Theme.of(context).colorScheme.primary,
)
: const SizedBox(),
: const SizedBox.shrink(),
),
]
],
@@ -1832,7 +1832,7 @@ class HeaderControlState extends State<HeaderControl> {
Icons.done,
color: Theme.of(context).colorScheme.primary,
)
: const SizedBox(),
: const SizedBox.shrink(),
)
],
],
@@ -2014,7 +2014,7 @@ class HeaderControlState extends State<HeaderControl> {
}
clock?.cancel();
clock = null;
return SizedBox.shrink();
return const SizedBox.shrink();
},
),
if (videoDetailCtr.enableSponsorBlock == true)