🐛 Fix some bugs in post search UI
This commit is contained in:
@@ -79,31 +79,10 @@ class PostSearchScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
isNoBackground: false,
|
isNoBackground: false,
|
||||||
appBar: isWideScreen(context)
|
appBar: AppBar(
|
||||||
? null
|
title: Text('searchPosts'.tr()),
|
||||||
: AppBar(
|
actions: [
|
||||||
title: Row(
|
if (!isWideScreen(context))
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextField(
|
|
||||||
controller: searchController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: 'search'.tr(),
|
|
||||||
border: InputBorder.none,
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Theme.of(context).appBarTheme.foregroundColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).appBarTheme.foregroundColor,
|
|
||||||
),
|
|
||||||
onChanged: onSearchChanged,
|
|
||||||
onSubmitted: (value) {
|
|
||||||
onSearchChanged(value, skipDebounce: true);
|
|
||||||
},
|
|
||||||
autofocus: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
showFilters.value
|
showFilters.value
|
||||||
@@ -115,7 +94,6 @@ class PostSearchScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
body: Consumer(
|
body: Consumer(
|
||||||
builder: (context, ref, child) {
|
builder: (context, ref, child) {
|
||||||
final searchState = ref.watch(
|
final searchState = ref.watch(
|
||||||
@@ -152,10 +130,7 @@ class PostSearchScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SliverGap(16),
|
const SliverGap(12),
|
||||||
if (showFilters.value && !isWideScreen(context))
|
|
||||||
SliverToBoxAdapter(child: buildFilterPanel()),
|
|
||||||
// Use PaginationList with isSliver=true
|
|
||||||
PaginationList(
|
PaginationList(
|
||||||
provider: postListProvider(
|
provider: postListProvider(
|
||||||
PostListQueryConfig(id: kSearchPostListId),
|
PostListQueryConfig(id: kSearchPostListId),
|
||||||
@@ -246,6 +221,28 @@ class PostSearchScreen extends HookConsumerWidget {
|
|||||||
)
|
)
|
||||||
: CustomScrollView(
|
: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
|
const SliverGap(4),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: SearchBar(
|
||||||
|
elevation: WidgetStateProperty.all(4),
|
||||||
|
controller: searchController,
|
||||||
|
hintText: 'search'.tr(),
|
||||||
|
leading: const Icon(Icons.search),
|
||||||
|
padding: WidgetStateProperty.all(
|
||||||
|
const EdgeInsets.symmetric(horizontal: 24),
|
||||||
|
),
|
||||||
|
onChanged: onSearchChanged,
|
||||||
|
onSubmitted: (value) {
|
||||||
|
onSearchChanged(value, skipDebounce: true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
if (showFilters.value)
|
if (showFilters.value)
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Center(
|
child: Center(
|
||||||
@@ -255,7 +252,6 @@ class PostSearchScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Use PaginationList with isSliver=true
|
|
||||||
PaginationList(
|
PaginationList(
|
||||||
provider: postListProvider(
|
provider: postListProvider(
|
||||||
PostListQueryConfig(id: kSearchPostListId),
|
PostListQueryConfig(id: kSearchPostListId),
|
||||||
|
|||||||
Reference in New Issue
Block a user