Closed Princewil closed 2 months ago
Hi @Princewil, Are you using the latest version of the plugin on pub.dev? I am guessing you are seeing the same issue as https://github.com/maheshj01/searchfield/issues/159 which was fixed in the latest release
Yea I am using the latest version which is v1.0.9
@Princewil Please share a minimal and complete reprpduciblel code sample.
Now run the below code on your desktop and try selecting any suggestion with YOUR PHYSICAL KEYBOARD ONLY and press the ENTER Key to pick an option
import 'package:flutter/material.dart';
import 'package:searchfield/searchfield.dart';
class Code extends StatelessWidget {
const Code({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SearchField(
suggestions: ['ABC', 'DEF', 'GHI', 'JKL']
.map((e) => SearchFieldListItem(e, child: Text(e)))
.toList(),
onSubmit: (v) => print(v),
onSuggestionTap: (v) {
print('SuggestionTaped => ${v.searchKey}');
},
onScroll: (p, p1) {
print(p);
print(p1);
},
),
),
);
}
}
You get this error Null check operator used on a null value
@Princewil I Appreciate the minimal code sample, I was able to reproduce the issue, I will take a look at it.
Thanks
Alright bro Thanks
Hi dear, thanks a lot for this package.
I recommend you go through the video attached to this first.
I create a desktop application where the user interact more with their physical keyboard. I used this package to give suggestions of product stored on the backend as seen in the video. The searchtextfield is meant to only contain any selected suggestion from the suggestion list, anything else is disregarded. So I observed when I use my keyboard to interact with the suggestions and click on the enter key, the
onSubmit
callback is called but this callback returns the string on the textfield and not the selected suggestion. And it becomes a problem if there is not text on the textfield as seen on this video. Now In my attempt in trying to return something I wrote a logic that returns the best possible suggestion using the returned string gotten from the callback(see code). But this does not give the best results as seen in the video.
https://github.com/user-attachments/assets/31ba284c-f0c3-45ff-885c-fee38dba7417
Describe the solution you'd like Is there a way to return the index of selected suggestion via the
onsubmit
callbackDescribe alternatives you've considered Or probably return the suggestion itself.
Thanks