opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-02 13:00:31 +08:00
parent eafaa1b045
commit 3919e42b59
28 changed files with 67 additions and 62 deletions

View File

@@ -50,7 +50,8 @@ class _PagesPanelState extends State<PagesPanel> {
if (!mounted) return;
setState(() {});
const double itemWidth = 150; // 每个列表项的宽度
final double targetOffset = min((pageIndex * itemWidth) - (itemWidth / 2),
final double targetOffset = (pageIndex * itemWidth - itemWidth / 2).clamp(
_scrollController.position.minScrollExtent,
_scrollController.position.maxScrollExtent);
// 滑动至目标位置
_scrollController.animateTo(