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();
_logic = DiscoverBinding().create(search: context.read<SearchRepository>());
_logic.addListener(_rebuild);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _logic.searchFocus.requestFocus();
});
}
void _rebuild() {
@@ -59,21 +56,27 @@ class _SearchPageState extends State<SearchPage> {
value: SystemUiOverlayStyle.light,
child: Theme(
data: AppTheme.dark(),
child: Scaffold(
key: const Key('search-page'),
backgroundColor: AppColors.appBackground,
body: SafeArea(
child: Column(
children: [
_header(l10n),
Expanded(
child: AppPullToRefresh(
key: const Key('search-refresh'),
onRefresh: _logic.refreshSearch,
child: _body(l10n),
child: MediaQuery.removeViewInsets(
context: context,
removeBottom: true,
child: Scaffold(
key: const Key('search-page'),
backgroundColor: AppColors.appBackground,
resizeToAvoidBottomInset: false,
body: SafeArea(
bottom: false,
child: Column(
children: [
_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,
contentPadding: EdgeInsets.zero,
),
scrollPadding: EdgeInsets.zero,
),
),
if (_logic.searchLoading)