Skip to content

Commit 9c49e20

Browse files
committed
Allow to specify maxLines
Fixes: 4inka#31
1 parent 2ea0322 commit 9c49e20

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ The above example will generate something like below preview:
228228
| suggestionBackgroundColor | `Color` | :x: | Can be used to set custom background color to suggestions list | |
229229
| debounceDuration | `Duration` | :x: | Used to set the debounce time for async data fetch | Duration(milliseconds: 400) |
230230
| suggestionBuilder | `Widget Function(String)` | :x: | Can be used to customize suggestion items | |
231-
| progressIndicatorBuilder | `Widget` | :x: | Can be used to display custom progress idnicator | |
231+
| progressIndicatorBuilder | `Widget` | :x: | Can be used to display custom progress indicator | |
232+
| maxLines | `int` | :x: | Can be used to specify the number of lines of the input, default is 1 | |
232233

233234
## Issues & Suggestions
234235
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).

Diff for: lib/easy_autocomplete.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,15 @@ class EasyAutocomplete extends StatefulWidget {
8989
/// Can be used to customize suggestion items
9090
final Widget Function(String data)? suggestionBuilder;
9191

92-
/// Can be used to display custom progress idnicator
92+
/// Can be used to display custom progress indicator
9393
final Widget? progressIndicatorBuilder;
9494

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

98+
/// Can be used to specify the maximum number of lines
99+
final int maxLines;
100+
98101
/// Creates a autocomplete widget to help you manage your suggestions
99102
const EasyAutocomplete(
100103
{this.suggestions,
@@ -116,6 +119,7 @@ class EasyAutocomplete extends StatefulWidget {
116119
this.suggestionTextStyle = const TextStyle(),
117120
this.suggestionBackgroundColor,
118121
this.debounceDuration = const Duration(milliseconds: 400),
122+
this.maxLines = 1,
119123
this.validator})
120124
: assert(onChanged != null || controller != null,
121125
'onChanged and controller parameters cannot be both null at the same time'),
@@ -269,7 +273,8 @@ class _EasyAutocompleteState extends State<EasyAutocomplete> {
269273
onEditingComplete: () => closeOverlay(),
270274
validator: widget.validator != null
271275
? (value) => widget.validator!(value)
272-
: null // (value) {}
276+
: null, // (value) {}
277+
maxLines: widget.maxLines,
273278
)
274279
]));
275280
}

0 commit comments

Comments
 (0)