scroll to current rank

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-02-06 11:39:31 +08:00
parent 1ad710c1cf
commit 42e082bbc6
2 changed files with 25 additions and 2 deletions

View File

@@ -43,18 +43,22 @@ class _RankPageState extends State<RankPage>
);
}
static const double _tabHeight = 35.0;
Widget _buildTab(ThemeData theme) {
return SizedBox(
width: 64,
child: Obx(() {
final tabIndex = _rankController.tabIndex.value;
return ListView.builder(
controller: _rankController.tabScrollController,
padding: .only(bottom: MediaQuery.paddingOf(context).bottom + 105),
itemCount: RankType.values.length,
itemBuilder: (context, index) {
final item = RankType.values[index];
final isCurr = index == tabIndex;
return IntrinsicHeight(
return SizedBox(
height: _tabHeight,
child: Material(
color: isCurr
? theme.colorScheme.onInverseSurface
@@ -64,7 +68,8 @@ class _RankPageState extends State<RankPage>
? _rankController.animateToTop
: () => _rankController
..tabIndex.value = index
..tabController.animateTo(index),
..tabController.animateTo(index)
..scrollToCurrentIndex(_tabHeight, index),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [