💄 Optimize the search message a step further

This commit is contained in:
2025-10-10 00:43:49 +08:00
parent 4321aa621a
commit b43b70df3f

View File

@@ -82,6 +82,9 @@ class _SearchFilters extends StatelessWidget {
withLinks.value = value!; withLinks.value = value!;
performSearch(searchController.text); performSearch(searchController.text);
}, },
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
FilterChip( FilterChip(
@@ -92,6 +95,9 @@ class _SearchFilters extends StatelessWidget {
withAttachments.value = value!; withAttachments.value = value!;
performSearch(searchController.text); performSearch(searchController.text);
}, },
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
), ),
], ],
); );
@@ -193,12 +199,13 @@ class SearchMessagesScreen extends HookConsumerWidget {
children: [ children: [
// Search input section // Search input section
Container( Container(
decoration: BoxDecoration( margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
color: Theme.of(context).cardColor, child: Material(
borderRadius: const BorderRadius.vertical( elevation: 2,
bottom: Radius.circular(8), color: Theme.of(context).colorScheme.surfaceContainerHighest,
), borderRadius: BorderRadius.circular(32),
), child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8),
child: child:
isLarge isLarge
? Row( ? Row(
@@ -211,28 +218,32 @@ class SearchMessagesScreen extends HookConsumerWidget {
hintText: 'searchMessagesHint'.tr(), hintText: 'searchMessagesHint'.tr(),
border: InputBorder.none, border: InputBorder.none,
isDense: true, isDense: true,
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.symmetric(
left: 16, horizontal: 12,
right: 16, vertical: 12,
top: 12,
bottom: 16,
), ),
suffixIcon: Row( suffixIcon: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (searchResultCount.value != null && if (searchResultCount.value != null &&
searchState.value == SearchState.results) searchState.value ==
SearchState.results)
Container( Container(
margin: const EdgeInsets.only(right: 8), margin: const EdgeInsets.only(
right: 8,
),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 8, horizontal: 8,
vertical: 2, vertical: 2,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of( color: Theme.of(context)
context, .colorScheme
).colorScheme.primary.withOpacity(0.1), .primary
borderRadius: BorderRadius.circular(12), .withOpacity(0.1),
borderRadius: BorderRadius.circular(
12,
),
), ),
child: Text( child: Text(
'${searchResultCount.value}', '${searchResultCount.value}',
@@ -265,11 +276,6 @@ class SearchMessagesScreen extends HookConsumerWidget {
const SizedBox(width: 16), const SizedBox(width: 16),
SingleChildScrollView( SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Padding(
padding: const EdgeInsets.only(
bottom: 8,
right: 12,
),
child: _SearchFilters( child: _SearchFilters(
withLinks: withLinks, withLinks: withLinks,
withAttachments: withAttachments, withAttachments: withAttachments,
@@ -278,7 +284,6 @@ class SearchMessagesScreen extends HookConsumerWidget {
isLarge: isLarge, isLarge: isLarge,
), ),
), ),
),
], ],
) )
: Column( : Column(
@@ -290,17 +295,16 @@ class SearchMessagesScreen extends HookConsumerWidget {
hintText: 'searchMessagesHint'.tr(), hintText: 'searchMessagesHint'.tr(),
border: InputBorder.none, border: InputBorder.none,
isDense: true, isDense: true,
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.symmetric(
left: 16, horizontal: 12,
right: 16, vertical: 12,
top: 12,
bottom: 16,
), ),
suffixIcon: Row( suffixIcon: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (searchResultCount.value != null && if (searchResultCount.value != null &&
searchState.value == SearchState.results) searchState.value ==
SearchState.results)
Container( Container(
margin: const EdgeInsets.only(right: 8), margin: const EdgeInsets.only(right: 8),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -308,10 +312,13 @@ class SearchMessagesScreen extends HookConsumerWidget {
vertical: 2, vertical: 2,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of( color: Theme.of(context)
context, .colorScheme
).colorScheme.primary.withOpacity(0.1), .primary
borderRadius: BorderRadius.circular(12), .withOpacity(0.1),
borderRadius: BorderRadius.circular(
12,
),
), ),
child: Text( child: Text(
'${searchResultCount.value}', '${searchResultCount.value}',
@@ -342,21 +349,29 @@ class SearchMessagesScreen extends HookConsumerWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 16, left: 8,
right: 16, right: 8,
top: 8,
bottom: 8, bottom: 8,
), ),
child: _SearchFilters( child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
_SearchFilters(
withLinks: withLinks, withLinks: withLinks,
withAttachments: withAttachments, withAttachments: withAttachments,
performSearch: performSearch, performSearch: performSearch,
searchController: searchController, searchController: searchController,
isLarge: false, isLarge: false,
), ),
],
),
), ),
], ],
), ),
), ),
),
),
// Search results section // Search results section
Expanded( Expanded(