opt: pgc timeline

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-13 21:08:22 +08:00
parent 68df173558
commit 6ac482ed5e
4 changed files with 43 additions and 7 deletions

View File

@@ -16,6 +16,8 @@ class BangumiController extends CommonListController<
RxBool isLogin = false.obs;
int? mid;
late final showPgcTimeline =
tabType == TabType.bangumi && GStorage.showPgcTimeline;
@override
void onInit() {
@@ -25,7 +27,7 @@ class BangumiController extends CommonListController<
queryData();
queryBangumiFollow();
if (tabType == TabType.bangumi) {
if (showPgcTimeline) {
queryPgcTimeline();
}
if (isLogin.value) {
@@ -40,7 +42,7 @@ class BangumiController extends CommonListController<
followEnd = false;
}
queryBangumiFollow();
if (tabType == TabType.bangumi) {
if (showPgcTimeline) {
queryPgcTimeline();
}
return super.onRefresh();

View File

@@ -55,12 +55,11 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
_buildFollow,
if (widget.tabType == TabType.bangumi)
if (controller.showPgcTimeline)
SliverToBoxAdapter(
child: Container(
margin: const EdgeInsets.only(top: 10),
child: SizedBox(
height: Grid.smallCardWidth / 2 / 0.75 +
MediaQuery.textScalerOf(context).scale(110),
MediaQuery.textScalerOf(context).scale(96),
child:
Obx(() => _buildTimeline(controller.timelineState.value)),
),
@@ -109,6 +108,30 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
child: TabBar(
isScrollable: true,
tabAlignment: TabAlignment.start,
dividerHeight: 0,
overlayColor:
WidgetStateProperty.all(Colors.transparent),
splashFactory: NoSplash.splashFactory,
indicatorPadding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 10,
),
indicator: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondaryContainer,
borderRadius: const BorderRadius.all(
Radius.circular(20)),
),
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context)
.colorScheme
.onSecondaryContainer,
labelStyle: TabBarTheme.of(context)
.labelStyle
?.copyWith(fontSize: 14) ??
const TextStyle(fontSize: 14),
dividerColor: Colors.transparent,
tabs: loadingState.response!
.map(
(item) => Tab(
@@ -122,7 +145,6 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
),
],
),
const SizedBox(height: 10),
Expanded(
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),

View File

@@ -2158,6 +2158,14 @@ List<SettingsModel> get extraSettings => [
setKey: SettingBoxKey.enableDragSubtitle,
defaultVal: false,
),
SettingsModel(
settingsType: SettingsType.sw1tch,
title: '展示追番时间表',
leading: Icon(MdiIcons.chartTimelineVariantShimmer),
setKey: SettingBoxKey.showPgcTimeline,
defaultVal: true,
needReboot: true,
),
SettingsModel(
settingsType: SettingsType.sw1tch,
enableFeedback: true,

View File

@@ -468,6 +468,9 @@ class GStorage {
static String get webdavDirectory =>
GStorage.setting.get(SettingBoxKey.webdavDirectory, defaultValue: '/');
static bool get showPgcTimeline =>
GStorage.setting.get(SettingBoxKey.showPgcTimeline, defaultValue: true);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -755,6 +758,7 @@ class SettingBoxKey {
fastForBackwardDuration = 'fastForBackwardDuration',
recordSearchHistory = 'recordSearchHistory',
navSearchStreamDebounce = 'navSearchStreamDebounce',
showPgcTimeline = 'showPgcTimeline',
// WebDAV
webdavUri = 'webdavUri',