Closed
Description
I'm trying to build a instance of FormBuilderTypeAhead with a custom controller, but it breaks at flutter_form_builder/src/fields/form_builder_typeahead.dart:173:32
.
Apparently the package is not initializing the variable _typeAheadController
if a custom controller is provided.
My code is as follows:
var _controller = TextEditingController(text: "");
return FormBuilderTypeAhead(
attribute: "city",
controller: _controller,
decoration: InputDecoration(
hintText: 'City',
labelText: 'City',
),
itemBuilder: (context, suggestion) {
return ListTile(
title: Text(suggestion.label),
);
},
transitionBuilder: (context, suggestionsBox, controller) {
return suggestionsBox;
},
selectionToTextTransformer: (MOption suggestion) {
return suggestion.toString();
},
suggestionsCallback: (pattern) async {
var s = CitiesService.getOptions(pattern);
s.add(MOption(label: 'Create $pattern...', value: -1));
return s;
},
onSuggestionSelected: (suggestion) {
print(suggestion.toString());
},
);