better search design

master
gitea 1 month ago
parent 98b9dbe6ea
commit c99774e42b

@ -461,19 +461,55 @@ class _RecipesScreenState extends State<RecipesScreen> with WidgetsBindingObserv
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
toolbarHeight: (_isSearching && _selectedTags.isNotEmpty) ? 80 : null,
title: _isSearching title: _isSearching
? TextField( ? Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 4),
child: TextField(
controller: _searchController, controller: _searchController,
autofocus: true, autofocus: true,
decoration: const InputDecoration( decoration: const InputDecoration(
hintText: 'Search recipes...', hintText: 'Search recipes...',
border: InputBorder.none, border: InputBorder.none,
hintStyle: TextStyle(color: Colors.white70), hintStyle: TextStyle(color: Colors.white70),
contentPadding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
), ),
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
onChanged: (_) => _filterRecipes(), onChanged: (_) => _filterRecipes(),
),
),
if (_selectedTags.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 2, bottom: 4, left: 4, right: 4),
child: RichText(
maxLines: 1,
overflow: TextOverflow.ellipsis,
text: TextSpan(
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w400,
),
children: [
const TextSpan(
text: 'Tag: ',
style: TextStyle(color: Colors.grey),
),
TextSpan(
text: _selectedTags.join(', '),
style: const TextStyle(color: Colors.green),
),
],
),
),
),
],
) )
: const Text('All Recipes'), : const Text('All Recipes'),
titleSpacing: _isSearching ? 0 : null,
elevation: 0, elevation: 0,
bottom: _buildTagFilterBar(), bottom: _buildTagFilterBar(),
actions: [ actions: [
@ -667,18 +703,18 @@ class _RecipesScreenState extends State<RecipesScreen> with WidgetsBindingObserv
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
_searchController.text.isEmpty (_searchController.text.isNotEmpty || _selectedTags.isNotEmpty)
? 'No recipes yet' ? 'No recipes found'
: 'No recipes found', : 'No recipes yet',
style: Theme.of(context).textTheme.titleLarge?.copyWith( style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.grey[600], color: Colors.grey[600],
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
_searchController.text.isEmpty (_searchController.text.isNotEmpty || _selectedTags.isNotEmpty)
? 'Tap the + button to create your first recipe' ? 'Try a different search term'
: 'Try a different search term', : 'Tap the + button to create your first recipe',
style: Theme.of(context).textTheme.bodyMedium?.copyWith( style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.grey[500], color: Colors.grey[500],
), ),

Loading…
Cancel
Save

Powered by TurnKey Linux.