Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-23 19:50:11 +08:00
parent 7eaf05839a
commit 0ab07a713e
22 changed files with 443 additions and 470 deletions

View File

@@ -24,71 +24,7 @@ class _RankPageState extends State<RankPage>
final theme = Theme.of(context);
return Row(
children: [
SizedBox(
width: 64,
child: ListView(
padding: const EdgeInsets.only(bottom: 100),
children: List.generate(
RankType.values.length,
(index) => IntrinsicHeight(
child: Obx(
() {
final isCurr = index == _rankController.tabIndex.value;
return Material(
color: isCurr
? theme.colorScheme.onInverseSurface
: theme.colorScheme.surface,
child: InkWell(
onTap: () {
if (isCurr) {
_rankController.animateToTop();
} else {
_rankController
..tabIndex.value = index
..tabController.animateTo(index);
}
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isCurr)
Container(
height: double.infinity,
width: 3,
color: theme.colorScheme.primary,
)
else
const SizedBox(width: 3),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(
vertical: 7,
),
child: Text(
RankType.values[index].label,
style: TextStyle(
color: isCurr
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
fontSize: 15,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
],
),
),
);
},
),
),
),
),
),
_buildTab(theme),
Expanded(
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
@@ -106,4 +42,69 @@ class _RankPageState extends State<RankPage>
],
);
}
Widget _buildTab(ThemeData theme) {
return SizedBox(
width: 64,
child: Obx(() {
final tabIndex = _rankController.tabIndex.value;
return ListView(
padding: .only(bottom: MediaQuery.paddingOf(context).bottom + 105),
children: RankType.values.map((e) {
final index = e.index;
final isCurr = index == tabIndex;
return IntrinsicHeight(
child: Material(
color: isCurr
? theme.colorScheme.onInverseSurface
: theme.colorScheme.surface,
child: InkWell(
onTap: () {
if (isCurr) {
_rankController.animateToTop();
} else {
_rankController
..tabIndex.value = index
..tabController.animateTo(index);
}
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isCurr)
Container(
width: 3,
height: double.infinity,
color: theme.colorScheme.primary,
)
else
const SizedBox(width: 3),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
padding: const .symmetric(vertical: 7),
child: Text(
RankType.values[index].label,
style: TextStyle(
color: isCurr
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
fontSize: 15,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
],
),
),
),
);
}).toList(),
);
}),
);
}
}