Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-07-04 17:51:54 +08:00
parent 46ce01d76f
commit fd017e0581
8 changed files with 40 additions and 46 deletions

View File

@@ -92,7 +92,7 @@ mixin CommonDynPageMixin<T extends StatefulWidget>
child: Padding( child: Padding(
padding: const .fromLTRB(12, 2.5, 6, 2.5), padding: const .fromLTRB(12, 2.5, 6, 2.5),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: .spaceBetween,
children: [ children: [
Obx( Obx(
() { () {

View File

@@ -183,7 +183,7 @@ class _MainReplyPageState extends State<MainReplyPage>
child: Padding( child: Padding(
padding: const .fromLTRB(12, 2.5, 6, 2.5), padding: const .fromLTRB(12, 2.5, 6, 2.5),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: .spaceBetween,
children: [ children: [
Obx( Obx(
() { () {

View File

@@ -377,7 +377,7 @@ class _PgcReviewChildPageState extends State<PgcReviewChildPage>
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(12, 2.5, 6, 2.5), padding: const EdgeInsets.fromLTRB(12, 2.5, 6, 2.5),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: .spaceBetween,
children: [ children: [
Obx( Obx(
() { () {

View File

@@ -123,7 +123,7 @@ class _NoteListPageState extends State<NoteListPage>
); );
if (_isNested) { if (_isNested) {
child = ExtendedVisibilityDetector( child = ExtendedVisibilityDetector(
uniqueKey: const Key('note-list'), uniqueKey: const ValueKey(NoteListPage),
child: child, child: child,
); );
} }

View File

@@ -262,7 +262,7 @@ class _PostPanelState extends State<PostPanel>
); );
if (_isNested) { if (_isNested) {
child = ExtendedVisibilityDetector( child = ExtendedVisibilityDetector(
uniqueKey: const Key('post-panel'), uniqueKey: const ValueKey(PostPanel),
child: child, child: child,
); );
} }

View File

@@ -38,6 +38,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
SingleTickerProviderStateMixin, SingleTickerProviderStateMixin,
BaseFabMixin, BaseFabMixin,
FabMixin { FabMixin {
late ColorScheme colorScheme;
late VideoReplyController _videoReplyController; late VideoReplyController _videoReplyController;
String get heroTag => widget.heroTag; String get heroTag => widget.heroTag;
@@ -57,6 +58,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
colorScheme = ColorScheme.of(context);
bottom = MediaQuery.viewPaddingOf(context).bottom; bottom = MediaQuery.viewPaddingOf(context).bottom;
} }
@@ -65,7 +67,6 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
final theme = Theme.of(context);
final child = NotificationListener<UserScrollNotification>( final child = NotificationListener<UserScrollNotification>(
onNotification: (notification) { onNotification: (notification) {
switch (notification.direction) { switch (notification.direction) {
@@ -81,7 +82,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
onRefresh: _videoReplyController.onRefresh, onRefresh: _videoReplyController.onRefresh,
isClampingScrollPhysics: widget.isNested, isClampingScrollPhysics: widget.isNested,
child: Stack( child: Stack(
clipBehavior: Clip.none, clipBehavior: .none,
children: [ children: [
CustomScrollView( CustomScrollView(
controller: widget.isNested controller: widget.isNested
@@ -91,45 +92,41 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
key: const PageStorageKey(_VideoReplyPanelState), key: const PageStorageKey(_VideoReplyPanelState),
slivers: [ slivers: [
SliverFloatingHeaderWidget( SliverFloatingHeaderWidget(
backgroundColor: theme.colorScheme.surface, backgroundColor: colorScheme.surface,
child: Padding( child: Padding(
padding: const .fromLTRB(12, 2.5, 6, 2.5), padding: const .fromLTRB(12, 2.5, 6, 2.5),
child: Row( child: Obx(() {
mainAxisAlignment: MainAxisAlignment.spaceBetween, final sortType = _videoReplyController.sortType.value;
children: [ return Row(
Obx( mainAxisAlignment: .spaceBetween,
() => Text( children: [
_videoReplyController.sortType.value.title, Text(
sortType.title,
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
), TextButton.icon(
TextButton.icon( style: Style.buttonStyle,
style: Style.buttonStyle, onPressed: _videoReplyController.queryBySort,
onPressed: _videoReplyController.queryBySort, icon: Icon(
icon: Icon( Icons.sort,
Icons.sort, size: 16,
size: 16, color: colorScheme.secondary,
color: theme.colorScheme.secondary, ),
), label: Text(
label: Obx( sortType.label,
() => Text(
_videoReplyController.sortType.value.label,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: theme.colorScheme.secondary, color: colorScheme.secondary,
), ),
), ),
), ),
), ],
], );
), }),
), ),
), ),
Obx( Obx(
() => _buildBody( () => _buildBody(_videoReplyController.loadingState.value),
theme,
_videoReplyController.loadingState.value,
),
), ),
], ],
), ),
@@ -165,17 +162,14 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
); );
if (widget.isNested) { if (widget.isNested) {
return ExtendedVisibilityDetector( return ExtendedVisibilityDetector(
uniqueKey: const Key('reply-list'), uniqueKey: const ValueKey(VideoReplyPanel),
child: child, child: child,
); );
} }
return child; return child;
} }
Widget _buildBody( Widget _buildBody(LoadingState<List<ReplyInfo>?> loadingState) {
ThemeData theme,
LoadingState<List<ReplyInfo>?> loadingState,
) {
return switch (loadingState) { return switch (loadingState) {
Loading() => SliverList.builder( Loading() => SliverList.builder(
itemBuilder: (context, index) => const VideoReplySkeleton(), itemBuilder: (context, index) => const VideoReplySkeleton(),
@@ -189,14 +183,14 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
_videoReplyController.onLoadMore(); _videoReplyController.onLoadMore();
return Container( return Container(
height: 125, height: 125,
alignment: Alignment.center, alignment: .center,
margin: EdgeInsets.only(bottom: bottom), margin: .only(bottom: bottom),
child: Text( child: Text(
_videoReplyController.isEnd ? '没有更多了' : '加载中...', _videoReplyController.isEnd ? '没有更多了' : '加载中...',
textAlign: TextAlign.center, textAlign: .center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: theme.colorScheme.outline, color: colorScheme.outline,
), ),
), ),
); );

View File

@@ -246,9 +246,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
return SliverPinnedHeader( return SliverPinnedHeader(
backgroundColor: colorScheme.surface, backgroundColor: colorScheme.surface,
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(12, 2.5, 6, 2.5), padding: const .fromLTRB(12, 2.5, 6, 2.5),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: .spaceBetween,
children: [ children: [
Obx( Obx(
() { () {

View File

@@ -115,7 +115,7 @@ class _ViewPointsPageState extends State<ViewPointsPage>
); );
if (_isNested) { if (_isNested) {
return ExtendedVisibilityDetector( return ExtendedVisibilityDetector(
uniqueKey: const Key('viewpoints'), uniqueKey: const ValueKey(ViewPointsPage),
child: child, child: child,
); );
} }