Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-21 11:13:26 +08:00
parent 9df9132be9
commit a4b0b16a19
14 changed files with 206 additions and 356 deletions

View File

@@ -5,37 +5,46 @@ import 'package:PiliPlus/pages/rank/zone/view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class RankPage extends StatefulWidget {
class RankPage extends StatelessWidget {
const RankPage({super.key});
@override
State<RankPage> createState() => _RankPageState();
}
class _RankPageState extends State<RankPage>
with AutomaticKeepAliveClientMixin {
final RankController _rankController = Get.put(RankController());
@override
bool get wantKeepAlive => true;
@override
Widget build(BuildContext context) {
super.build(context);
final theme = Theme.of(context);
final rankController = Get.put(RankController());
Widget buildTab(ThemeData theme) {
return VerticalTabBar(
dividerWidth: 0,
isScrollable: true,
indicatorWeight: 3,
indicatorSize: .tab,
controller: rankController.tabController,
padding: .only(bottom: MediaQuery.paddingOf(context).bottom + 105),
tabs: RankType.values.map((e) => VerticalTab(text: e.label)).toList(),
onTap: (index) {
if (!rankController.tabController.indexIsChanging) {
rankController.animateToTop();
} else {
rankController
..tabIndex.value = index
..tabController.animateTo(index);
}
},
);
}
return Row(
children: [
_buildTab(theme),
buildTab(theme),
Expanded(
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
controller: _rankController.tabController,
controller: rankController.tabController,
children: RankType.values
.map(
(item) => ZonePage(
rid: item.rid,
seasonType: item.seasonType,
),
(item) =>
ZonePage(rid: item.rid, seasonType: item.seasonType),
)
.toList(),
),
@@ -43,25 +52,4 @@ class _RankPageState extends State<RankPage>
],
);
}
Widget _buildTab(ThemeData theme) {
return VerticalTabBar(
dividerWidth: 0,
isScrollable: true,
indicatorWeight: 3,
indicatorSize: .tab,
controller: _rankController.tabController,
padding: .only(bottom: MediaQuery.paddingOf(context).bottom + 105),
tabs: RankType.values.map((e) => VerticalTab(text: e.label)).toList(),
onTap: (index) {
if (!_rankController.tabController.indexIsChanging) {
_rankController.animateToTop();
} else {
_rankController
..tabIndex.value = index
..tabController.animateTo(index);
}
},
);
}
}