From 0870f2710ed6e8a1eb5fa011ff3e91a9f97eaaf8 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 20 Jan 2025 12:47:19 +0800 Subject: [PATCH] opt: search page Signed-off-by: bggRGjQaUbCoE --- lib/pages/main/view.dart | 1 + lib/pages/search/view.dart | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index f03d45f1..f9730212 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -411,6 +411,7 @@ class _MainAppState extends State : const SizedBox.shrink(), ), IconButton( + tooltip: '搜索', icon: const Icon( Icons.search_outlined, semanticLabel: '搜索', diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index c74c6bff..6c0b238c 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -74,12 +74,22 @@ class _SearchPageState extends State with RouteAware { child: Column( children: [ // 搜索建议 - _searchSuggest(), - if (_searchController.enableHotKey) - // 热搜 - hotSearch(), - // 搜索历史 - _history() + if (_searchController.searchSuggestion) _searchSuggest(), + if (context.orientation == Orientation.portrait) ...[ + if (_searchController.enableHotKey) + // 热搜 + hotSearch(), + // 搜索历史 + _history() + ] else + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (_searchController.enableHotKey) + Expanded(child: hotSearch()), + Expanded(child: _history()), + ], + ), ], ), ), @@ -174,7 +184,11 @@ class _SearchPageState extends State with RouteAware { width: double.infinity, padding: EdgeInsets.fromLTRB( 10, - _searchController.enableHotKey ? 0 : 6, + context.orientation == Orientation.landscape + ? 25 + : _searchController.enableHotKey + ? 0 + : 6, 6, MediaQuery.of(context).padding.bottom + 50, ),