Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Allow to specify maxLines #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ The above example will generate something like below preview:
| suggestionBackgroundColor | `Color` | :x: | Can be used to set custom background color to suggestions list | |
| debounceDuration | `Duration` | :x: | Used to set the debounce time for async data fetch | Duration(milliseconds: 400) |
| suggestionBuilder | `Widget Function(String)` | :x: | Can be used to customize suggestion items | |
| progressIndicatorBuilder | `Widget` | :x: | Can be used to display custom progress idnicator | |
| progressIndicatorBuilder | `Widget` | :x: | Can be used to display custom progress indicator | |
| maxLines | `int` | :x: | Can be used to specify the number of lines of the input, default is 1 | |

## Issues & Suggestions
If you encounter any issue you or want to leave a suggestion you can do it by filling an [issue](https://github.com/4inka/flutter_easy_autocomplete/issues).
Expand Down
9 changes: 7 additions & 2 deletions lib/easy_autocomplete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ class EasyAutocomplete extends StatefulWidget {
/// Can be used to customize suggestion items
final Widget Function(String data)? suggestionBuilder;

/// Can be used to display custom progress idnicator
/// Can be used to display custom progress indicator
final Widget? progressIndicatorBuilder;

/// Can be used to validate field value
final String? Function(String?)? validator;

/// Can be used to specify the maximum number of lines
final int maxLines;

/// Creates a autocomplete widget to help you manage your suggestions
const EasyAutocomplete(
{this.suggestions,
Expand All @@ -116,6 +119,7 @@ class EasyAutocomplete extends StatefulWidget {
this.suggestionTextStyle = const TextStyle(),
this.suggestionBackgroundColor,
this.debounceDuration = const Duration(milliseconds: 400),
this.maxLines = 1,
this.validator})
: assert(onChanged != null || controller != null,
'onChanged and controller parameters cannot be both null at the same time'),
Expand Down Expand Up @@ -269,7 +273,8 @@ class _EasyAutocompleteState extends State<EasyAutocomplete> {
onEditingComplete: () => closeOverlay(),
validator: widget.validator != null
? (value) => widget.validator!(value)
: null // (value) {}
: null, // (value) {}
maxLines: widget.maxLines,
)
]));
}
Expand Down