salim-lachdhaf / searchable_dropdown

Simple and robust Dropdown with item search feature, making it possible to use an offline item list or filtering URL for easy customization.
MIT License
326 stars 316 forks source link

DropdownSearch not scrolling to initial item when opened. #608

Closed a7mdragab closed 4 months ago

a7mdragab commented 8 months ago

Is there an existing issue for this?

Package/Plugin version

^10.1.0

Platforms

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel beta, 3.14.0-0.2.pre, on Microsoft Windows [Version 10.0.22621.2428], locale en-US) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.1) [√] Android Studio (version 2022.3) [√] VS Code (version 1.84.0) [√] Connected device (4 available)

Hello, I want the DropdownSearch to scroll to initial item when opened. This widget opens every time from the start.

Minimal code example

        DropdownSearch<int>(
            key: UniqueKey(),
            name: 'DropdownSearch',
            items: List.generate(100, (index) => index),
            selectedItem: 50,
            compareFn: (a, b) => a == b,
          ),

Current Behavior

This widget opens every time from the start.

Expected Behavior

I want the DropdownSearch to scroll to initial item when opened.

Steps To Reproduce

Just use this widget

Additional information

image

salim-lachdhaf commented 4 months ago

Yes, the library is not scrolling to the selected item. The question is: why do we need to scroll to the selected item if it's already visible?

Note that you can have a list where the selected item is not included.

a7mdragab commented 4 days ago

Yes, the library is not scrolling to the selected item. The question is: why do we need to scroll to the selected item if it's already visible?

Note that you can have a list where the selected item is not included.

Sorry for being late. But it is not always visible like this

image

Could it be added fast?