mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: rank page
This commit is contained in:
@@ -79,199 +79,179 @@ List tabsConfig = [
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 0,
|
||||
'label': '全站',
|
||||
'type': RandType.all,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 0), tag: '0'),
|
||||
'page': const ZonePage(rid: 0),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 168,
|
||||
'label': '国创',
|
||||
'type': RandType.creation,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 168), tag: '168'),
|
||||
'page': const ZonePage(rid: 168),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 1,
|
||||
'label': '动画',
|
||||
'type': RandType.animation,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 1), tag: '1'),
|
||||
'page': const ZonePage(rid: 1),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 3,
|
||||
'label': '音乐',
|
||||
'type': RandType.music,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 3), tag: '3'),
|
||||
'page': const ZonePage(rid: 3),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 129,
|
||||
'label': '舞蹈',
|
||||
'type': RandType.dance,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 129), tag: '129'),
|
||||
'page': const ZonePage(rid: 129),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 4,
|
||||
'label': '游戏',
|
||||
'type': RandType.game,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 4), tag: '4'),
|
||||
'page': const ZonePage(rid: 4),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 36,
|
||||
'label': '知识',
|
||||
'type': RandType.knowledge,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 36), tag: '36'),
|
||||
'page': const ZonePage(rid: 36),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 188,
|
||||
'label': '科技',
|
||||
'type': RandType.technology,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 188), tag: '188'),
|
||||
'page': const ZonePage(rid: 188),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 234,
|
||||
'label': '运动',
|
||||
'type': RandType.sport,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 234), tag: '234'),
|
||||
'page': const ZonePage(rid: 234),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 223,
|
||||
'label': '汽车',
|
||||
'type': RandType.car,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 223), tag: '223'),
|
||||
'page': const ZonePage(rid: 223),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 160,
|
||||
'label': '生活',
|
||||
'type': RandType.life,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 160), tag: '160'),
|
||||
'page': const ZonePage(rid: 160),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 211,
|
||||
'label': '美食',
|
||||
'type': RandType.food,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 211), tag: '211'),
|
||||
'page': const ZonePage(rid: 211),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 217,
|
||||
'label': '动物',
|
||||
'type': RandType.animal,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 217), tag: '217'),
|
||||
'page': const ZonePage(rid: 217),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 119,
|
||||
'label': '鬼畜',
|
||||
'type': RandType.madness,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 119), tag: '119'),
|
||||
'page': const ZonePage(rid: 119),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 155,
|
||||
'label': '时尚',
|
||||
'type': RandType.fashion,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 155), tag: '155'),
|
||||
'page': const ZonePage(rid: 155),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 5,
|
||||
'label': '娱乐',
|
||||
'type': RandType.entertainment,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 5), tag: '5'),
|
||||
'page': const ZonePage(rid: 5),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 181,
|
||||
'label': '影视',
|
||||
'type': RandType.film,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 181), tag: '181'),
|
||||
'page': const ZonePage(rid: 181),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 177,
|
||||
'label': '纪录',
|
||||
'type': RandType.documentary,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 177), tag: '177'),
|
||||
'page': const ZonePage(rid: 177),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 23,
|
||||
'label': '电影',
|
||||
'type': RandType.movie,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 23), tag: '23'),
|
||||
'page': const ZonePage(rid: 23),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'rid': 11,
|
||||
'label': '剧集',
|
||||
'type': RandType.teleplay,
|
||||
'ctr': Get.put<ZoneController>(ZoneController(zoneID: 11), tag: '11'),
|
||||
'page': const ZonePage(rid: 11),
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPalaX/pages/rank/zone/index.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
@@ -9,7 +10,6 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
late RxList tabs = [].obs;
|
||||
RxInt initialIndex = 0.obs;
|
||||
late TabController tabController;
|
||||
late List tabsCtrList;
|
||||
late List<Widget> tabsPageList;
|
||||
Box setting = GStorage.setting;
|
||||
// late final StreamController<bool> searchBarStream =
|
||||
@@ -27,21 +27,20 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
|
||||
void onRefresh() {
|
||||
int index = tabController.index;
|
||||
var ctr = tabsCtrList[index];
|
||||
ctr.onRefresh();
|
||||
Get.find<ZoneController>(tag: tabsConfig[index]['rid'].toString())
|
||||
.onRefresh();
|
||||
}
|
||||
|
||||
void animateToTop() {
|
||||
int index = tabController.index;
|
||||
var ctr = tabsCtrList[index];
|
||||
ctr.animateToTop();
|
||||
Get.find<ZoneController>(tag: tabsConfig[index]['rid'].toString())
|
||||
.animateToTop();
|
||||
}
|
||||
|
||||
void setTabConfig() async {
|
||||
tabs.value = tabsConfig;
|
||||
initialIndex.value = 0;
|
||||
tabsCtrList = tabs.map((e) => e['ctr']).toList();
|
||||
tabsPageList = tabs.map<Widget>((e) => e['page']).toList();
|
||||
tabsPageList = tabs.map((item) => ZonePage(rid: item['rid'])).toList();
|
||||
|
||||
tabController = TabController(
|
||||
initialIndex: initialIndex.value,
|
||||
|
||||
Reference in New Issue
Block a user