Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

feat: add collect page count (#1783)

玲羽8fcae5581714
diff --git a/lib/pages/collect/collect_page.dart b/lib/pages/collect/collect_page.dart
index 8aad24a3..cc7458a4 100644
--- a/lib/pages/collect/collect_page.dart
+++ b/lib/pages/collect/collect_page.dart
@@ -267,6 +267,8 @@ class _CollectPageState extends State<CollectPage>
}
List<Widget> contentGrid(List<CollectedBangumi> collectedBangumiList) {
+ final bool showAnimeCounter =
+ GStorage.getSetting(SettingsKeys.showAnimeCounter);
List<Widget> gridViewList = [];
List<List<CollectedBangumi>> collectedBangumiRenderItemList =
List.generate(tabs.length, (_) => <CollectedBangumi>[]);
@@ -345,6 +347,25 @@ class _CollectPageState extends State<CollectPage>
),
),
),
+ if (collectedBangumiRenderItem.isNotEmpty && showAnimeCounter)
+ SliverFillRemaining(
+ hasScrollBody: false,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 12, bottom: 12),
+ child: Text(
+ '总计:${collectedBangumiRenderItem.length}',
+ style: TextStyle(
+ fontSize: 13,
+ color: Theme.of(context).colorScheme.onSurfaceVariant,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
],
),
);
diff --git a/lib/pages/settings/interface_settings.dart b/lib/pages/settings/interface_settings.dart
index 6c524243..1e6a151e 100644
--- a/lib/pages/settings/interface_settings.dart
+++ b/lib/pages/settings/interface_settings.dart
@@ -14,6 +14,7 @@ class InterfaceSettingsPage extends StatefulWidget {
class _InterfaceSettingsPageState extends State<InterfaceSettingsPage> {
late bool showRating;
+ late bool showAnimeCounter;
late String defaultPage;
final MenuController defaultPageMenuController = MenuController();
@@ -28,6 +29,7 @@ class _InterfaceSettingsPageState extends State<InterfaceSettingsPage> {
void initState() {
super.initState();
showRating = GStorage.getSetting(SettingsKeys.showRating);
+ showAnimeCounter = GStorage.getSetting(SettingsKeys.showAnimeCounter);
defaultPage = GStorage.getSetting(SettingsKeys.defaultStartupPage);
}
@@ -108,6 +110,19 @@ class _InterfaceSettingsPageState extends State<InterfaceSettingsPage> {
initialValue: showRating,
),
]),
+ SettingsSection(tiles: [
+ SettingsTile.switchTile(
+ onToggle: (value) async {
+ showAnimeCounter = value ?? !showAnimeCounter;
+ await GStorage.putSetting(SettingsKeys.showAnimeCounter, showAnimeCounter);
+ setState(() {});
+ },
+ title: Text('显示追番统计', style: TextStyle(fontFamily: fontFamily)),
+ description: Text('启用后将在追番页面下方显示追番统计',
+ style: TextStyle(fontFamily: fontFamily)),
+ initialValue: showAnimeCounter,
+ ),
+ ]),
],
),
);
diff --git a/lib/services/storage/settings_keys.dart b/lib/services/storage/settings_keys.dart
index 526b8d21..efa04e40 100644
--- a/lib/services/storage/settings_keys.dart
+++ b/lib/services/storage/settings_keys.dart
@@ -416,6 +416,11 @@ class SettingsKeys {
true,
group: SettingGroup.interface,
);
+ static const showAnimeCounter = SettingKey<bool>(
+ _SettingBoxKey.showAnimeCounter,
+ false,
+ group: SettingGroup.interface,
+ );
static const downloadParallelEpisodes = SettingKey<int>(
_SettingBoxKey.downloadParallelEpisodes,
2,
@@ -558,6 +563,7 @@ class SettingsKeys {
proxyUrl,
proxyTestUrl,
showRating,
+ showAnimeCounter,
downloadParallelEpisodes,
downloadParallelSegments,
downloadDanmaku,
@@ -665,6 +671,7 @@ class _SettingBoxKey {
proxyUrl = 'proxyUrl',
proxyTestUrl = 'proxyTestUrl',
showRating = 'showRating',
+ showAnimeCounter = 'showAnimeCounter',
downloadParallelEpisodes = 'downloadParallelEpisodes',
downloadParallelSegments = 'downloadParallelSegments',
downloadDanmaku = 'downloadDanmaku',