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

Update 2.7.0 #30

Open
wants to merge 3 commits 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
14 changes: 10 additions & 4 deletions lib/easy_autocomplete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ class EasyAutocomplete extends StatefulWidget {
final Widget Function(String data)? suggestionBuilder;

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

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

final double maxListHeight;

/// Creates a autocomplete widget to help you manage your suggestions
const EasyAutocomplete(
{this.suggestions,
{Key? key,
this.suggestions,
this.asyncSuggestions,
this.suggestionBuilder,
this.progressIndicatorBuilder,
this.progressIndicatorBuilder = const CircularProgressIndicator(),
this.controller,
this.decoration = const InputDecoration(),
this.onChanged,
Expand All @@ -116,7 +119,8 @@ class EasyAutocomplete extends StatefulWidget {
this.suggestionTextStyle = const TextStyle(),
this.suggestionBackgroundColor,
this.debounceDuration = const Duration(milliseconds: 400),
this.validator})
this.validator,
this.maxListHeight = 150})
: assert(onChanged != null || controller != null,
'onChanged and controller parameters cannot be both null at the same time'),
assert(!(controller != null && initialValue != null),
Expand Down Expand Up @@ -176,13 +180,15 @@ class _EasyAutocompleteState extends State<EasyAutocomplete> {
showWhenUnlinked: false,
offset: Offset(0.0, size.height + 5.0),
child: FilterableList(
key: widget.key,
loading: _isLoading,
suggestionBuilder: widget.suggestionBuilder,
progressIndicatorBuilder: widget.progressIndicatorBuilder,
items: _suggestions,
suggestionTextStyle: widget.suggestionTextStyle,
suggestionBackgroundColor:
widget.suggestionBackgroundColor,
maxListHeight: widget.maxListHeight,
onItemTapped: (value) {
_controller
..value = TextEditingValue(
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/filterable_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class FilterableList extends StatelessWidget {
final Widget? progressIndicatorBuilder;

const FilterableList(
{required this.items,
{Key? key,
required this.items,
required this.onItemTapped,
this.suggestionBuilder,
this.elevation = 5,
Expand Down