feat: 隐藏热搜热榜的功能 issues#35

This commit is contained in:
guozhigq
2023-08-27 12:12:51 +08:00
parent b9e78bf2ec
commit 9528a6f462
4 changed files with 15 additions and 1 deletions

View File

@ -21,6 +21,8 @@ class SSearchController extends GetxController {
Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间 Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间
String hintText = '搜索'; String hintText = '搜索';
RxString defaultSearch = '输入关键词搜索'.obs; RxString defaultSearch = '输入关键词搜索'.obs;
Box setting = GStrorage.setting;
bool enableHotKey = true;
@override @override
void onInit() { void onInit() {
@ -38,6 +40,7 @@ class SSearchController extends GetxController {
} }
historyCacheList = histiryWord.get('cacheList') ?? []; historyCacheList = histiryWord.get('cacheList') ?? [];
historyList.value = historyCacheList; historyList.value = historyCacheList;
enableHotKey = setting.get(SettingBoxKey.enableHotKey, defaultValue: true);
} }
void onChange(value) { void onChange(value) {

View File

@ -146,7 +146,9 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
// 搜索建议 // 搜索建议
_searchSuggest(), _searchSuggest(),
// 热搜 // 热搜
hotSearch(_searchController), Visibility(
visible: _searchController.enableHotKey,
child: hotSearch(_searchController)),
// 搜索历史 // 搜索历史
_history() _history()
], ],

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:pilipala/models/common/dynamics_type.dart'; import 'package:pilipala/models/common/dynamics_type.dart';
import 'package:pilipala/models/common/reply_sort_type.dart'; import 'package:pilipala/models/common/reply_sort_type.dart';
@ -47,6 +48,13 @@ class _ExtraSettingState extends State<ExtraSetting> {
), ),
body: ListView( body: ListView(
children: [ children: [
SetSwitchItem(
title: '大家都在搜',
subTitle: '是否展示「大家都在搜」',
setKey: SettingBoxKey.enableHotKey,
defaultVal: true,
callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
),
ListTile( ListTile(
dense: false, dense: false,
title: Text('评论展示', style: titleStyle), title: Text('评论展示', style: titleStyle),

View File

@ -105,6 +105,7 @@ class SettingBoxKey {
static const String autoUpdate = 'autoUpdate'; static const String autoUpdate = 'autoUpdate';
static const String replySortType = 'replySortType'; static const String replySortType = 'replySortType';
static const String defaultDynamicType = 'defaultDynamicType'; static const String defaultDynamicType = 'defaultDynamicType';
static const String enableHotKey = 'enableHotKey';
/// 外观 /// 外观
static const String themeMode = 'themeMode'; static const String themeMode = 'themeMode';