Skip to content

Commit

Permalink
TW-1812 Remove X from the search bar when it's empty
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim committed Jun 4, 2024
1 parent 6a3421e commit 947b0b9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/pages/search/search_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ class SearchTextField extends StatelessWidget {
size: SearchViewStyle.searchIconSize,
color: Theme.of(context).colorScheme.onSurface,
),
suffixIcon: TwakeIconButton(
tooltip: L10n.of(context)!.close,
icon: Icons.close,
onTap: () {
textEditingController.clear();
suffixIcon: ValueListenableBuilder(
valueListenable: textEditingController,
builder: (context, value, child) {
return textEditingController.text.isNotEmpty
? TwakeIconButton(
tooltip: L10n.of(context)!.close,
icon: Icons.close,
onTap: () {
textEditingController.clear();
},
)
: const SizedBox.shrink();
},
),
),
Expand Down

0 comments on commit 947b0b9

Please sign in to comment.