artflutter / flutter_awesome_select

Forked from https://github.com/davigmacode/flutter_smart_select, updated legacy code, migrated to null safety and more. AwesomeSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.
https://pub.dev/packages/flutter_awesome_select
MIT License
15 stars 33 forks source link

Make shrink wrapping items configurable to disable default behavior of resizing bottom sheet #24

Open absar opened 1 year ago

absar commented 1 year ago

The default behavior of shrink wrapping items has a bad UX as the list resizes when the number of available choices are changed e.g. when user taps to select a different set of items, which should be made configurable so that it could be disabled, while keeping the default behavior intact for backward compatibility.

Current behavior:

https://user-images.githubusercontent.com/1186833/193661862-711bf2e4-a02d-4631-b50a-bf7d16e0614a.mp4

Expected behavior:

https://user-images.githubusercontent.com/1186833/193662046-45fde1d8-bf35-4470-ac4a-ad1338e7550f.mp4

absar commented 1 year ago

Fixed in PR #25. Added a new parameter to not shrink wrap list items using S2ChoiceConfig.shrinkWrap or SmartSelect.single.choiceShrinkWrap/SmartSelect.multiple.choiceShrinkWrap. If choiceShrinkWrap is true choices list will shrink wrap the choices, causing the list to resize based on the number of available choices, by default it will shrink wrap which was the default behavior before this change. Usage:

SmartSelect<T?>.single(
  choiceShrinkWrap: false
);
SmartSelect<T?>.multiple(
  choiceShrinkWrap: false
);