Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing text controller as a parameter of TagsTextField #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/src/suggestions_textfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SuggestionsTextField extends StatefulWidget {
}

class _SuggestionsTextFieldState extends State<SuggestionsTextField> {
final _controller = TextEditingController();
TextEditingController _controller = TextEditingController();

List<String> _matches = List();
String _helperText;
Expand All @@ -48,6 +48,9 @@ class _SuggestionsTextFieldState extends State<SuggestionsTextField> {
_constraintSuggestion = widget.tagsTextField.constraintSuggestion;
_inputDecoration = widget.tagsTextField.inputDecoration;
_fontSize = widget.tagsTextField.textStyle.fontSize;
_controller = widget.tagsTextField.controller == null
? _controller
: widget.tagsTextField.controller;

return Stack(
alignment: Alignment.centerLeft,
Expand Down Expand Up @@ -195,7 +198,8 @@ class TagsTextField {
this.maxLength,
this.inputDecoration,
this.onSubmitted,
this.onChanged});
this.onChanged,
this.controller});

final double width;
final EdgeInsets padding;
Expand All @@ -220,4 +224,5 @@ class TagsTextField {
final int maxLength;
final OnSubmittedCallback onSubmitted;
final OnChangedCallback onChanged;
final controller;
}