mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 16:46:22 +08:00
@@ -8,8 +8,6 @@ import 'package:PiliPlus/pages/common/common_controller.dart';
|
||||
import 'package:PiliPlus/pages/mine/view.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -59,9 +57,8 @@ class HomeController extends GetxController
|
||||
}
|
||||
|
||||
void setTabConfig() {
|
||||
List<int>? localTabs = GStorage.setting.get(SettingBoxKey.tabBarSort);
|
||||
tabs =
|
||||
localTabs?.map((i) => HomeTabType.values[i]).toList() ??
|
||||
Pref.tabbarSort?.map((i) => HomeTabType.values[i]).toList() ??
|
||||
HomeTabType.values;
|
||||
|
||||
tabController = TabController(
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/models/common/home_tab_type.dart';
|
||||
import 'package:PiliPlus/models/common/member/tab_type.dart';
|
||||
import 'package:PiliPlus/models/common/msg/msg_unread_type.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
@@ -95,41 +94,34 @@ class Pref {
|
||||
),
|
||||
);
|
||||
|
||||
static List<int> get tabbarSort => List<int>.from(
|
||||
_setting.get(SettingBoxKey.tabBarSort) ??
|
||||
HomeTabType.values.map((item) => item.index).toList(),
|
||||
);
|
||||
static List<int>? get tabbarSort =>
|
||||
(_setting.get(SettingBoxKey.tabBarSort) as List?)?.cast<int>();
|
||||
|
||||
static List<Pair<SegmentType, SkipType>> get blockSettings {
|
||||
List<int> list = List<int>.from(
|
||||
_setting.get(SettingBoxKey.blockSettings) ??
|
||||
List.generate(SegmentType.values.length, (_) => 1),
|
||||
);
|
||||
List<int>? list = (_setting.get(SettingBoxKey.blockSettings) as List?)
|
||||
?.cast<int>();
|
||||
return SegmentType.values
|
||||
.map(
|
||||
(item) => Pair<SegmentType, SkipType>(
|
||||
first: item,
|
||||
second: SkipType.values[list[item.index]],
|
||||
second: SkipType.values[list?[item.index] ?? 1],
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
static List<Color> get blockColor {
|
||||
List<String> list = List<String>.from(
|
||||
_setting.get(SettingBoxKey.blockColor) ??
|
||||
List.generate(SegmentType.values.length, (_) => ''),
|
||||
);
|
||||
return SegmentType.values
|
||||
.map(
|
||||
(item) => list[item.index].isNotEmpty
|
||||
? Color(
|
||||
int.tryParse('FF${list[item.index]}', radix: 16) ??
|
||||
0xFF000000,
|
||||
)
|
||||
: item.color,
|
||||
)
|
||||
.toList();
|
||||
List<String>? list = (_setting.get(SettingBoxKey.blockColor) as List?)
|
||||
?.cast<String>();
|
||||
return SegmentType.values.map(
|
||||
(item) {
|
||||
final e = list?[item.index];
|
||||
final color = e != null && e.isNotEmpty
|
||||
? int.tryParse('FF$e', radix: 16)
|
||||
: null;
|
||||
return color != null ? Color(color) : item.color;
|
||||
},
|
||||
).toList();
|
||||
}
|
||||
|
||||
static bool get hiddenSettingUnlocked =>
|
||||
|
||||
Reference in New Issue
Block a user