diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index b698bdd5c..85aa65267 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -154,8 +154,10 @@ class _HomePageState extends State Widget get customAppBar { return StreamBuilder( stream: _homeController.hideSearchBar - ? _homeController.searchBarStream.stream - .throttle(const Duration(milliseconds: 500)) + ? _mainController.navSearchStreamDebounce + ? _homeController.searchBarStream.stream + .throttle(const Duration(milliseconds: 500)) + : _homeController.searchBarStream.stream : null, initialData: true, builder: (BuildContext context, AsyncSnapshot snapshot) { diff --git a/lib/pages/main/controller.dart b/lib/pages/main/controller.dart index 1cca1fccb..cc42ef5b2 100644 --- a/lib/pages/main/controller.dart +++ b/lib/pages/main/controller.dart @@ -38,6 +38,7 @@ class MainController extends GetxController { late int lastCheckUnreadAt = 0; late final mainTabBarView = GStorage.mainTabBarView; + late bool navSearchStreamDebounce = GStorage.navSearchStreamDebounce; @override void onInit() { diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index 35ea73db1..d91de1347 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -264,8 +264,10 @@ class _MainAppState extends State ? null : StreamBuilder( stream: _mainController.hideTabBar - ? _mainController.bottomBarStream.stream - .throttle(const Duration(milliseconds: 500)) + ? _mainController.navSearchStreamDebounce + ? _mainController.bottomBarStream.stream + .throttle(const Duration(milliseconds: 500)) + : _mainController.bottomBarStream.stream : null, initialData: true, builder: (context, AsyncSnapshot snapshot) { diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index ea9e0ec5a..d286bcede 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -421,6 +421,19 @@ List get styleSettings => [ defaultVal: true, needReboot: true, ), + SettingsModel( + settingsType: SettingsType.sw1tch, + title: '降低收起/展开顶/底栏频率', + leading: const Icon(Icons.vertical_distribute), + setKey: SettingBoxKey.navSearchStreamDebounce, + defaultVal: false, + onChanged: (value) { + try { + Get.find().navSearchStreamDebounce = value; + Get.forceAppUpdate(); + } catch (_) {} + }, + ), SettingsModel( settingsType: SettingsType.normal, onTap: (setState) { diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 9057f34bd..5c8c37b71 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -445,6 +445,9 @@ class GStorage { static bool get recordSearchHistory => GStorage.setting .get(SettingBoxKey.recordSearchHistory, defaultValue: true); + static bool get navSearchStreamDebounce => GStorage.setting + .get(SettingBoxKey.navSearchStreamDebounce, defaultValue: false); + static List get dynamicDetailRatio => List.from(setting .get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0])); @@ -728,6 +731,7 @@ class SettingBoxKey { enableDragSubtitle = 'enableDragSubtitle', fastForBackwardDuration = 'fastForBackwardDuration', recordSearchHistory = 'recordSearchHistory', + navSearchStreamDebounce = 'navSearchStreamDebounce', // Sponsor Block enableSponsorBlock = 'enableSponsorBlock',