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
325 stars 316 forks source link

Try adding space between searchbox and popup menu #613

Open anonimeact opened 6 months ago

anonimeact commented 6 months ago

Hi, i try to add space between the searchbox and popup menu by add custom positionCalback like this, and not working.

return RelativeRect.fromSize(
      Rect.fromPoints(
        popupButtonObject.localToGlobal(popupButtonObject.size.bottomLeft(Offset(0, 20)), ancestor: overlay),
        popupButtonObject.localToGlobal(popupButtonObject.size.bottomRight(Offset.zero), ancestor: overlay),
      ),
      Size(overlay.size.width, overlay.size.height),
    );

but when i try changing 20 with negative value (e.g: -20), the popupmenu go up, Is there any suggestion regarding my confusion?

salim-lachdhaf commented 4 months ago

Could you please provide a reproducible example ?

zeeshanahmad0201 commented 4 weeks ago

You need to add the same value on both points. Please see the following

return RelativeRect.fromSize(
    Rect.fromPoints(
      popupButtonObject.localToGlobal(popupButtonObject.size.bottomLeft(const Offset(0, 20)), ancestor: overlay),
      popupButtonObject.localToGlobal(popupButtonObject.size.bottomRight(const Offset(0, 20)), ancestor: overlay),
    ),
    Size(overlay.size.width, overlay.size.height),
  );