diff --git a/lib/pages/bangumi/controller.dart b/lib/pages/bangumi/controller.dart index 11579780..446ed4e7 100644 --- a/lib/pages/bangumi/controller.dart +++ b/lib/pages/bangumi/controller.dart @@ -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(); diff --git a/lib/pages/bangumi/view.dart b/lib/pages/bangumi/view.dart index 9530847c..bea7c1fb 100644 --- a/lib/pages/bangumi/view.dart +++ b/lib/pages/bangumi/view.dart @@ -55,12 +55,11 @@ class _BangumiPageState extends CommonPageState 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 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 ), ], ), - const SizedBox(height: 10), Expanded( child: TabBarView( physics: const NeverScrollableScrollPhysics(), diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index 6546d948..4cfb61e0 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -2158,6 +2158,14 @@ List 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, diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 7143c67a..ec0395f7 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -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 get dynamicDetailRatio => List.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',