mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-20 18:40:13 +08:00
@@ -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);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user