Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-21 18:59:48 +08:00
parent 604d78ad6a
commit 2d66b1d8ca
4 changed files with 1113 additions and 1116 deletions

View File

@@ -59,10 +59,8 @@ class SSearchController extends GetxController {
controller.text = Get.parameters['text']!; controller.text = Get.parameters['text']!;
} }
if (recordSearchHistory.value) { historyList =
historyList = List<String>.from(GStorage.historyWord.get('cacheList') ?? []).obs;
List<String>.from(GStorage.historyWord.get('cacheList') ?? []).obs;
}
if (searchSuggestion) { if (searchSuggestion) {
_ctr = StreamController<String>(); _ctr = StreamController<String>();

View File

@@ -80,7 +80,7 @@ class _SearchPageState extends State<SearchPage> {
if (_searchController.searchSuggestion) _searchSuggest(), if (_searchController.searchSuggestion) _searchSuggest(),
if (context.orientation == Orientation.portrait) ...[ if (context.orientation == Orientation.portrait) ...[
if (_searchController.enableHotKey) hotSearch(theme), if (_searchController.enableHotKey) hotSearch(theme),
if (_searchController.recordSearchHistory.value) _history(theme), _history(theme),
if (_searchController.enableSearchRcmd) hotSearch(theme, false) if (_searchController.enableSearchRcmd) hotSearch(theme, false)
] else ] else
Row( Row(
@@ -97,8 +97,7 @@ class _SearchPageState extends State<SearchPage> {
], ],
), ),
), ),
if (_searchController.recordSearchHistory.value) Expanded(child: _history(theme)),
Expanded(child: _history(theme)),
], ],
), ),
], ],
@@ -207,28 +206,6 @@ class _SearchPageState extends State<SearchPage> {
), ),
), ),
), ),
// deprecated
// SizedBox(
// height: 34,
// child: TextButton(
// onPressed: () => Get.toNamed('/dynTopicRcmd'),
// child: Row(
// children: [
// Text(
// '话题',
// strutStyle:
// const StrutStyle(leading: 0, height: 1),
// style: style,
// ),
// Icon(
// size: 18,
// Icons.keyboard_arrow_right,
// color: outline,
// ),
// ],
// ),
// ),
// ),
], ],
) )
: text, : text,
@@ -272,23 +249,26 @@ class _SearchPageState extends State<SearchPage> {
} }
Widget _history(ThemeData theme) { Widget _history(ThemeData theme) {
final secondary = theme.colorScheme.secondary;
return Obx( return Obx(
() => Padding( () {
padding: EdgeInsets.fromLTRB( if (_searchController.historyList.isEmpty) {
10, return const SizedBox.shrink();
context.orientation == Orientation.landscape }
? 25 final secondary = theme.colorScheme.secondary;
: _searchController.enableHotKey return Padding(
? 0 padding: EdgeInsets.fromLTRB(
: 6, 10,
6, context.orientation == Orientation.landscape
25, ? 25
), : _searchController.enableHotKey
child: Column( ? 0
crossAxisAlignment: CrossAxisAlignment.start, : 6,
children: [ 6,
if (_searchController.historyList.isNotEmpty) 25,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(6, 0, 6, 6), padding: const EdgeInsets.fromLTRB(6, 0, 6, 6),
child: Row( child: Row(
@@ -301,28 +281,30 @@ class _SearchPageState extends State<SearchPage> {
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Obx( Obx(
() => SizedBox( () {
width: 34, bool enable =
height: 34, _searchController.recordSearchHistory.value;
child: IconButton( return SizedBox(
iconSize: 22, width: 34,
tooltip: _searchController.recordSearchHistory.value height: 34,
? '记录搜索' child: IconButton(
: '无痕搜索', iconSize: 22,
icon: _searchController.recordSearchHistory.value tooltip: enable ? '记录搜索' : '无痕搜索',
? historyIcon(theme) icon: enable
: historyIcon(theme).disable(), ? historyIcon(theme)
style: IconButton.styleFrom(padding: EdgeInsets.zero), : historyIcon(theme).disable(),
onPressed: () { style:
_searchController.recordSearchHistory.value = IconButton.styleFrom(padding: EdgeInsets.zero),
!_searchController.recordSearchHistory.value; onPressed: () {
GStorage.setting.put( enable = !enable;
SettingBoxKey.recordSearchHistory, _searchController.recordSearchHistory.value =
_searchController.recordSearchHistory.value, enable;
); GStorage.setting.put(
}, SettingBoxKey.recordSearchHistory, enable);
), },
), ),
);
},
), ),
const Spacer(), const Spacer(),
SizedBox( SizedBox(
@@ -351,8 +333,7 @@ class _SearchPageState extends State<SearchPage> {
], ],
), ),
), ),
Obx( Wrap(
() => Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
direction: Axis.horizontal, direction: Axis.horizontal,
@@ -367,10 +348,10 @@ class _SearchPageState extends State<SearchPage> {
) )
.toList(), .toList(),
), ),
), ],
], ),
), );
), },
); );
} }

View File

@@ -13,6 +13,4 @@ enum PlaySpeed {
final double value; final double value;
const PlaySpeed(this.value); const PlaySpeed(this.value);
String get desc => value == 1.0 ? '正常' : value.toString();
} }

File diff suppressed because it is too large Load Diff