refa persistent header & dynamic sliver appbar

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-02 16:16:17 +08:00
parent 1dbc54f063
commit 9c7b18710c
30 changed files with 1691 additions and 883 deletions

View File

@@ -1,7 +1,8 @@
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/skeleton/video_reply.dart';
import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart';
import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/sliver/sliver_floating_header.dart';
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
show ReplyInfo;
import 'package:PiliPlus/http/loading_state.dart';
@@ -83,47 +84,39 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
: _videoReplyController.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
key: const PageStorageKey(_VideoReplyPanelState),
slivers: <Widget>[
SliverPersistentHeader(
pinned: false,
floating: true,
delegate: CustomSliverPersistentHeaderDelegate(
extent: 40,
bgColor: theme.colorScheme.surface,
child: Container(
height: 40,
padding: const EdgeInsets.fromLTRB(12, 0, 6, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Obx(
() => Text(
_videoReplyController.sortType.value.title,
style: const TextStyle(fontSize: 13),
),
slivers: [
SliverFloatingHeaderWidget(
backgroundColor: theme.colorScheme.surface,
child: Padding(
padding: const .fromLTRB(12, 2.5, 6, 2.5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Obx(
() => Text(
_videoReplyController.sortType.value.title,
style: const TextStyle(fontSize: 13),
),
SizedBox(
height: 35,
child: TextButton.icon(
onPressed: _videoReplyController.queryBySort,
icon: Icon(
Icons.sort,
size: 16,
),
TextButton.icon(
style: StyleString.buttonStyle,
onPressed: _videoReplyController.queryBySort,
icon: Icon(
Icons.sort,
size: 16,
color: theme.colorScheme.secondary,
),
label: Obx(
() => Text(
_videoReplyController.sortType.value.label,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.secondary,
),
label: Obx(
() => Text(
_videoReplyController.sortType.value.label,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.secondary,
),
),
),
),
),
],
),
),
],
),
),
),