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

View File

@@ -55,12 +55,11 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
slivers: [ slivers: [
_buildFollow, _buildFollow,
if (widget.tabType == TabType.bangumi) if (controller.showPgcTimeline)
SliverToBoxAdapter( SliverToBoxAdapter(
child: Container( child: SizedBox(
margin: const EdgeInsets.only(top: 10),
height: Grid.smallCardWidth / 2 / 0.75 + height: Grid.smallCardWidth / 2 / 0.75 +
MediaQuery.textScalerOf(context).scale(110), MediaQuery.textScalerOf(context).scale(96),
child: child:
Obx(() => _buildTimeline(controller.timelineState.value)), Obx(() => _buildTimeline(controller.timelineState.value)),
), ),
@@ -109,6 +108,30 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
child: TabBar( child: TabBar(
isScrollable: true, isScrollable: true,
tabAlignment: TabAlignment.start, 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! tabs: loadingState.response!
.map( .map(
(item) => Tab( (item) => Tab(
@@ -122,7 +145,6 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
), ),
], ],
), ),
const SizedBox(height: 10),
Expanded( Expanded(
child: TabBarView( child: TabBarView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),

View File

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

View File

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