Skip to content

Commit 16767fd

Browse files
committed
Fix: Pass down parameters for flutter_typeahead to widget
1 parent 59780c2 commit 16767fd

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

lib/src/form_builder.dart

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class _FormBuilderState extends State<FormBuilder> {
5959

6060
@override
6161
Widget build(BuildContext context) {
62-
63-
6462
return Form(
6563
key: _formKey,
6664
onChanged: () {
@@ -81,7 +79,6 @@ class _FormBuilderState extends State<FormBuilder> {
8179
}
8280

8381
List<Widget> formControlsToForm() {
84-
8582
final formats = {
8683
InputType.both: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"),
8784
InputType.date: DateFormat('yyyy-MM-dd'),
@@ -202,7 +199,9 @@ class _FormBuilderState extends State<FormBuilder> {
202199
DateTimePickerFormField(
203200
inputType: InputType.both,
204201
initialValue: formControl.value,
205-
format: formControl.format != null ? DateFormat(formControl.format) : formats[InputType.both],
202+
format: formControl.format != null
203+
? DateFormat(formControl.format)
204+
: formats[InputType.both],
206205
editable: !(formControl.readonly || widget.readonly),
207206
firstDate: formControl.firstDate,
208207
lastDate: formControl.lastDate,
@@ -228,7 +227,9 @@ class _FormBuilderState extends State<FormBuilder> {
228227
DateTimePickerFormField(
229228
inputType: InputType.date,
230229
initialValue: formControl.value,
231-
format: formControl.format != null ? DateFormat(formControl.format) : formats[InputType.date],
230+
format: formControl.format != null
231+
? DateFormat(formControl.format)
232+
: formats[InputType.date],
232233
editable: !(formControl.readonly || widget.readonly),
233234
firstDate: formControl.firstDate,
234235
lastDate: formControl.lastDate,
@@ -254,7 +255,9 @@ class _FormBuilderState extends State<FormBuilder> {
254255
DateTimePickerFormField(
255256
inputType: InputType.time,
256257
initialValue: formControl.value,
257-
format: formControl.format != null ? DateFormat(formControl.format) : formats[InputType.time],
258+
format: formControl.format != null
259+
? DateFormat(formControl.format)
260+
: formats[InputType.time],
258261
editable: !(formControl.readonly || widget.readonly),
259262
decoration: InputDecoration(
260263
labelText: formControl.label,
@@ -310,6 +313,24 @@ class _FormBuilderState extends State<FormBuilder> {
310313
return formControl.validator(value);
311314
},
312315
onSaved: (value) => formData[formControl.attribute] = value,
316+
getImmediateSuggestions: formControl.getImmediateSuggestions,
317+
errorBuilder: formControl.errorBuilder,
318+
noItemsFoundBuilder: formControl.noItemsFoundBuilder,
319+
loadingBuilder: formControl.loadingBuilder,
320+
debounceDuration: formControl.debounceDuration,
321+
suggestionsBoxDecoration: formControl.suggestionsBoxDecoration,
322+
suggestionsBoxVerticalOffset:
323+
formControl.suggestionsBoxVerticalOffset,
324+
// transitionBuilder: formControl.transitionBuilder,
325+
animationDuration: formControl.animationDuration,
326+
animationStart: formControl.animationStart,
327+
direction: formControl.direction,
328+
hideOnLoading: formControl.hideOnLoading,
329+
hideOnEmpty: formControl.hideOnEmpty,
330+
hideOnError: formControl.hideOnError,
331+
hideSuggestionsOnKeyboardHide:
332+
formControl.hideSuggestionsOnKeyboardHide,
333+
keepSuggestionsOnLoading: formControl.keepSuggestionsOnLoading,
313334
));
314335
break;
315336

lib/src/form_builder_input.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class FormBuilderInput {
113113
this.value,
114114
this.require = false,
115115
this.validator,
116+
116117
this.getImmediateSuggestions,
117118
this.errorBuilder,
118119
this.noItemsFoundBuilder,

0 commit comments

Comments
 (0)