Skip to content

Commit

Permalink
refactor: Searchbar uses ZetaFormField
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecoomber committed Jul 29, 2024
1 parent e11ae3b commit 96c9ca0
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 289 deletions.
4 changes: 2 additions & 2 deletions example/lib/pages/components/search_bar_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class _SearchBarExampleState extends State<SearchBarExample> {
Padding(
padding: const EdgeInsets.all(20),
child: ZetaSearchBar(
onChanged: (value) {},
onChange: (value) {},
textInputAction: TextInputAction.search,
onSubmit: (text) {
onFieldSubmitted: (text) {
print(text);
},
),
Expand Down
3 changes: 3 additions & 0 deletions example/lib/pages/components/text_input_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TextInputExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
final controller = TextEditingController(text: 'Initial value');
final key = GlobalKey<FormState>();
return ExampleScaffold(
name: 'Text Input',
Expand All @@ -24,6 +25,8 @@ class TextInputExample extends StatelessWidget {
size: ZetaWidgetSize.large,
placeholder: 'Placeholder',
prefixText: '£',
controller: controller,
onChange: print,
label: 'Label',
requirementLevel: ZetaFormFieldRequirement.mandatory,
errorText: 'Error text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ Widget searchBarUseCase(BuildContext context) {
options: ZetaWidgetBorder.values,
labelBuilder: (shape) => shape.name,
);
final showLeadingIcon = context.knobs.boolean(
label: 'Show leading icon',
initialValue: true,
);
final showSpeechToText = context.knobs.boolean(
label: 'Show Speech-To-Text button',
initialValue: true,
Expand All @@ -54,9 +50,8 @@ Widget searchBarUseCase(BuildContext context) {
shape: shape,
disabled: disabled,
hint: hint,
showLeadingIcon: showLeadingIcon,
showSpeechToText: showSpeechToText,
onChanged: (value) {
onChange: (value) {
if (value == null) return;
setState(
() => items = _items
Expand Down
Loading

0 comments on commit 96c9ca0

Please sign in to comment.