Skip to content

Commit

Permalink
updated autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
clragon committed Nov 11, 2023
1 parent 97334ce commit 454882e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
23 changes: 15 additions & 8 deletions lib/interface/widgets/autocomplete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ class AutocompleteTextField<T> extends StatelessWidget {
return TypeAheadField<T>(
direction: direction ?? AxisDirection.up,
hideOnEmpty: true,
hideOnError: true,
hideKeyboard: readOnly,
keepSuggestionsOnSuggestionSelected: true,
suggestionsBoxDecoration: hasFab
? const SuggestionsBoxDecoration(
hideOnSelect: false,
suggestionsDecoration: hasFab
? const SuggestionsDecoration(
shape: AutocompleteCutout(),
clipBehavior: Clip.antiAlias,
)
: const SuggestionsBoxDecoration(),
: const SuggestionsDecoration(),
textFieldConfiguration: TextFieldConfiguration(
controller: controller,
autofocus: true,
Expand All @@ -59,16 +57,25 @@ class AutocompleteTextField<T> extends StatelessWidget {
InputDecoration(labelText: labelText),
onSubmitted: submit,
textInputAction: textInputAction ?? TextInputAction.search,
readOnly: readOnly,
),
loadingBuilder: (context) => const SizedBox(),
noItemsFoundBuilder: (context) => const ListTile(
loadingBuilder: (context) => const ListTile(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedCircularProgressIndicator(size: 24),
],
),
),
errorBuilder: (context, error) => const Column(
mainAxisSize: MainAxisSize.min,
children: [
IconMessage(
icon: Icon(Icons.error),
title: Text('Failed to load suggestions'),
),
],
),
onSuggestionSelected: onSuggestionSelected,
itemBuilder: itemBuilder,
suggestionsCallback: suggestionsCallback,
Expand Down
11 changes: 6 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,12 @@ packages:
flutter_typeahead:
dependency: "direct main"
description:
name: flutter_typeahead
sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818
url: "https://pub.dev"
source: hosted
version: "4.8.0"
path: "."
ref: cb34bae8e2094ed7e8268e18f514071f6f44826b
resolved-ref: cb34bae8e2094ed7e8268e18f514071f6f44826b
url: "https://github.com/clragon/flutter_typeahead.git"
source: git
version: "5.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
Expand Down
5 changes: 5 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ dependency_overrides:
git:
url: https://github.com/clragon/infinite_scroll_pagination.git
ref: 4.1.0-dev.2
flutter_typeahead:
# path: ../flutter_typeahead
git:
url: https://github.com/clragon/flutter_typeahead.git
ref: cb34bae8e2094ed7e8268e18f514071f6f44826b
collection: 1.18.0

dev_dependencies:
Expand Down

0 comments on commit 454882e

Please sign in to comment.