fix(search): 避免键盘顶起搜索页

This commit is contained in:
Zhou Weidong committed 2026-10-23 03:18:24 +08:00
1 parent f8500bbaca
commit ab6800aba2
1 file changed
+21 -17
+21 -17
View File
@@ -35,9 +35,6 @@ class _SearchPageState extends State<SearchPage> {
super.initState(); super.initState();
_logic = DiscoverBinding().create(search: context.read<SearchRepository>()); _logic = DiscoverBinding().create(search: context.read<SearchRepository>());
_logic.addListener(_rebuild); _logic.addListener(_rebuild);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _logic.searchFocus.requestFocus();
});
} }
void _rebuild() { void _rebuild() {
@@ -59,21 +56,27 @@ class _SearchPageState extends State<SearchPage> {
value: SystemUiOverlayStyle.light, value: SystemUiOverlayStyle.light,
child: Theme( child: Theme(
data: AppTheme.dark(), data: AppTheme.dark(),
child: Scaffold( child: MediaQuery.removeViewInsets(
key: const Key('search-page'), context: context,
backgroundColor: AppColors.appBackground, removeBottom: true,
body: SafeArea( child: Scaffold(
child: Column( key: const Key('search-page'),
children: [ backgroundColor: AppColors.appBackground,
_header(l10n), resizeToAvoidBottomInset: false,
Expanded( body: SafeArea(
child: AppPullToRefresh( bottom: false,
key: const Key('search-refresh'), child: Column(
onRefresh: _logic.refreshSearch, children: [
child: _body(l10n), _header(l10n),
Expanded(
child: AppPullToRefresh(
key: const Key('search-refresh'),
onRefresh: _logic.refreshSearch,
child: _body(l10n),
),
), ),
), ],
], ),
), ),
), ),
), ),
@@ -157,6 +160,7 @@ class _SearchPageState extends State<SearchPage> {
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
), ),
scrollPadding: EdgeInsets.zero,
), ),
), ),
if (_logic.searchLoading) if (_logic.searchLoading)