mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: tabbarSort
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -78,11 +78,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
|
|
||||||
void setTabConfig() async {
|
void setTabConfig() async {
|
||||||
defaultTabs = [...tabsConfig];
|
defaultTabs = [...tabsConfig];
|
||||||
tabbarSort = GStorage.setting
|
tabbarSort = GStorage.tabbarSort;
|
||||||
.get(SettingBoxKey.tabbarSort,
|
|
||||||
defaultValue: TabType.values.map((item) => item.name).toList())
|
|
||||||
.map<String>((i) => i.toString())
|
|
||||||
.toList();
|
|
||||||
defaultTabs.retainWhere(
|
defaultTabs.retainWhere(
|
||||||
(item) => tabbarSort.contains((item['type'] as TabType).name));
|
(item) => tabbarSort.contains((item['type'] as TabType).name));
|
||||||
defaultTabs.sort((a, b) => tabbarSort
|
defaultTabs.sort((a, b) => tabbarSort
|
||||||
|
|||||||
@@ -18,11 +18,7 @@ class _TabbarSetPageState extends State<TabbarSetPage> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
defaultTabs = tabsConfig;
|
defaultTabs = tabsConfig;
|
||||||
tabbarSort = GStorage.setting
|
tabbarSort = GStorage.tabbarSort;
|
||||||
.get(SettingBoxKey.tabbarSort,
|
|
||||||
defaultValue: ['live', 'rcmd', 'hot', 'rank', 'bangumi'])
|
|
||||||
.map<String>((i) => i.toString())
|
|
||||||
.toList();
|
|
||||||
// 对 tabData 进行排序
|
// 对 tabData 进行排序
|
||||||
defaultTabs.sort((a, b) {
|
defaultTabs.sort((a, b) {
|
||||||
int indexA = tabbarSort.indexOf((a['type'] as TabType).name);
|
int indexA = tabbarSort.indexOf((a['type'] as TabType).name);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'package:PiliPlus/common/widgets/pair.dart';
|
import 'package:PiliPlus/common/widgets/pair.dart';
|
||||||
import 'package:PiliPlus/http/constants.dart';
|
import 'package:PiliPlus/http/constants.dart';
|
||||||
import 'package:PiliPlus/models/common/dynamic_badge_mode.dart';
|
import 'package:PiliPlus/models/common/dynamic_badge_mode.dart';
|
||||||
|
import 'package:PiliPlus/models/common/tab_type.dart';
|
||||||
import 'package:PiliPlus/models/common/theme_type.dart';
|
import 'package:PiliPlus/models/common/theme_type.dart';
|
||||||
import 'package:PiliPlus/models/common/up_panel_position.dart';
|
import 'package:PiliPlus/models/common/up_panel_position.dart';
|
||||||
import 'package:PiliPlus/models/video/play/CDN.dart';
|
import 'package:PiliPlus/models/video/play/CDN.dart';
|
||||||
@@ -47,6 +48,9 @@ class GStorage {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static List<String> get tabbarSort => setting.get(SettingBoxKey.tabbarSort,
|
||||||
|
defaultValue: TabType.values.map((item) => item.name).toList());
|
||||||
|
|
||||||
static List<Pair<SegmentType, SkipType>> get blockSettings {
|
static List<Pair<SegmentType, SkipType>> get blockSettings {
|
||||||
List list = setting.get(
|
List list = setting.get(
|
||||||
SettingBoxKey.blockSettings,
|
SettingBoxKey.blockSettings,
|
||||||
|
|||||||
Reference in New Issue
Block a user