maheshj01 / searchfield

A highly customizable simple and easy to use flutter Widget to add a searchfield to your Flutter Application.This Widget allows you to search and select from list of suggestions.
MIT License
79 stars 58 forks source link

If the selected item’s position is greater than 10, auto scrolling won’t happen for that item. #155

Open santhosh-g-tz opened 1 month ago

santhosh-g-tz commented 1 month ago

Hi,

The scroll navigation not working if the current selected item position is more than 10. Note: my maxSuggestionsInViewPort is 10. windows

var countries = [
  'United States',
  'Germany',
  'Canada',
  'United Kingdom',
  'France',
  'Italy',
  'Spain',
  'Australia',
  'India',
  'China',
  'Japan',
  'Brazil',
  'South Africa',
  'Mexico',
  'Argentina',
  'Russia',
  'Indonesia',
  'Turkey',
  'Saudi Arabia',
  'Nigeria',
  'Egypt',
];

SearchField<String>(
  maxSuggestionsInViewPort:10,
  suggestions: countries
      .map(
        (e) => SearchFieldListItem<String>(
      e,
      item: e,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Text(e),
      ),
    ),
  ).toList(),
);

https://github.com/user-attachments/assets/5dcecff3-fc7a-415c-95da-b8ca953f7328

maheshj01 commented 1 month ago

Hello @santhosh-g-tz, Thanks for filing the issue. If I understand it right when the selected Items is out of view (not visible in the list) then arrows keys don't scroll to selected Item is that right?

santhosh-g-tz commented 1 month ago

@maheshmnj yes you are right.

maheshj01 commented 1 month ago

Thanks for the confirmation! Btw if you are interested you are welcome to contribute, I usually try to fix things over the weekend. And Review PRs throughout the week.

maheshj01 commented 1 month ago

Fixed and Released in v1.0.7

cc: @santhosh-g-tz

santhosh-g-tz commented 1 month ago

@maheshj01 Thank you for your support. It works as expected.

santhosh-g-tz commented 1 month ago

hi. After the implementation of this new feature, the selected item is not being chosen.

maheshj01 commented 1 month ago

I am seeing nuances of this issue I will leave this open for now until this is completely fixed part of #160

maheshj01 commented 1 month ago

Steps to reproduce

On the latest v1.0.8

Not able to capture it 100% of the time.