Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshj01 committed Nov 29, 2024
1 parent 24f3aab commit 6895b37
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ SearchField(
hint: 'Basic SearchField',
dynamicHeight: true,
maxSuggestionBoxHeight: 300,
// now the selectedValue is handled by the client
onSuggestionTap: (SearchFieldListItem<String> item) {
setState(() {
selectedValue = item;
selectedValue = item;
});
},
selectedValue: selectedValue,
selectedValue: selectedValue, // rename initialValue to selectedValue
suggestions: dynamicHeightSuggestion
.map(SearchFieldListItem<String>.new)
.toList(),
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ SearchField(
filled: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 20,
),
),
)),
suggestionsDecoration: suggestionDecoration,
suggestions: suggestions
.map((e) => SearchFieldListItem<String>(e, child: searchChild(e)))
Expand Down Expand Up @@ -176,6 +175,12 @@ Form(
}
return null;
},
selectedValue: selectedValue,
onSuggestionTap: (SearchFieldListItem<Country> x) {
setState(() {
selectedValue = x.item;
});
},
searchInputDecoration: SearchInputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
Expand Down Expand Up @@ -208,6 +213,12 @@ Form(
)))
.toList();
},
selectedValue: selectedValue,
onSuggestionTap: (SearchFieldListItem<Country> x) {
setState(() {
selectedValue = x.item;
});
},
key: const Key('searchfield'),
hint: 'Search by country name',
itemHeight: 50,
Expand Down Expand Up @@ -294,7 +305,7 @@ For documentation about the various parameters, see the [TextField] class and [T
- `focusNode` : FocusNode to interact with the searchfield.
- `hint` : hint for the search Input.
- `readOnly` : Defines whether to enable the searchfield defaults to `false`
- `initialValue` : The initial value to be set in searchfield when its rendered, if not specified it will be empty.
- `selectedValue` : The initial value to be set in searchfield when its rendered, if not specified it will be empty.
- `inputType`: Keyboard Type for SearchField
- `inputFormatters`: Input Formatter for SearchField
- `itemHeight` : height of each suggestion Item, (defaults to 51.0).
Expand All @@ -306,7 +317,7 @@ For documentation about the various parameters, see the [TextField] class and [T
- `onSaved` : An optional method to call with the final value when the form is saved via FormState.save.
- `onScroll` : callback when the suggestion list is scrolled. It returns the current scroll position in pixels and the max scroll position.
- `onSearchTextChanged`: callback when the searchfield text changes, it returns the current text in the searchfield.
- `onSuggestionTap` : callback when a sugestion is tapped it also returns the tapped value.
- `onSuggestionTap` : callback when a sugestion is tapped, it returns the tapped value which can be used to set the selectedValue.
- `onSubmit` : callback when the searchfield is submitted, it returns the current text in the searchfield.
- `onTap`: callback when the searchfield is tapped or brought into focus.
- `scrollbarDecoration`: decoration for the scrollbar.
Expand Down
2 changes: 1 addition & 1 deletion example/lib/dynamic_height.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _DynamicHeightExampleState extends State<DynamicHeightExample> {
color: Colors.grey.withOpacity(0.5),
),
),
// initialValue: SearchFieldListItem<UserModel>(
// selectedValue: SearchFieldListItem<UserModel>(
// users[2].name,
// child: Container(
// color: Colors.red,
Expand Down

0 comments on commit 6895b37

Please sign in to comment.