Skip to content

Commit

Permalink
added back onselected callback
Browse files Browse the repository at this point in the history
  • Loading branch information
RA341 committed Sep 22, 2024
1 parent 3d1906d commit 0447e08
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/components/url_autocomplete_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class UrlFieldInput extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final savedAddress = ref.read(allProfilesProvider);

// Needed to get width of the URL text field
// so we can assign that to the autocomplete width
final urlTextFieldKey = GlobalKey();
Expand All @@ -43,15 +44,18 @@ class UrlFieldInput extends ConsumerWidget {
.toLowerCase()
.contains(textEditingValue.text.toLowerCase()))
.map((e) => e.serverAdress!);

final options = result == null || result.isEmpty
? ['http://', 'https://']
.where((e) => e.contains(textEditingValue.text.toLowerCase()))
: result;

ref.read(optionsListProvider.notifier).overwriteList(options);
ref.invalidate(selectedOptionProvider);

return options;
},
// onSelected: (option) => serverAddress.text = option,
onSelected: (option) => serverAddress.text = option,
optionsViewOpenDirection: OptionsViewOpenDirection.down,
fieldViewBuilder: (context, controller, focusNode, _) {
return TextField(
Expand Down

0 comments on commit 0447e08

Please sign in to comment.