| 1 | import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:cake_wallet/generated/i18n.dart'; |
| 4 | |
| 5 | class SearchBarWidget extends StatelessWidget { |
| 6 | const SearchBarWidget({ |
| 7 | required this.searchController, |
| 8 | this.hintText, |
| 9 | super.key, |
| 10 | }); |
| 11 | |
| 12 | final TextEditingController searchController; |
| 13 | final String? hintText; |
| 14 | |
| 15 | @override |
| 16 | Widget build(BuildContext context) { |
| 17 | return BaseTextFormField( |
| 18 | key: ValueKey('search_bar_widget_key'), |
| 19 | controller: searchController, |
| 20 | textStyle: Theme.of(context) |
| 21 | .textTheme |
| 22 | .bodyMedium! |
| 23 | .copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant), |
| 24 | hintText: hintText ?? S.of(context).search, |
| 25 | placeholderTextStyle: Theme.of(context) |
| 26 | .textTheme |
| 27 | .bodyMedium! |
| 28 | .copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant), |
| 29 | prefixIcon: Icon(Icons.search, color: Theme.of(context).colorScheme.primary), |
| 30 | alignLabelWithHint: false, |
| 31 | contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16), |
| 32 | ); |
| 33 | } |
| 34 | } |