Closed brizaldi closed 4 years ago
The default behavior of the DropDown style is to expand to available space. Perhaps I need to rethink this.
Luckily, you can change any part of this widget without needing to edit the source.
In your case, you would like to override ListViewComponent
and MenuComponent
.
Please check out the complete usage example here (Please copy the code from this file if needed).
Widget _listViewBuilder(ListViewComponentData data) {
return ListView.builder(
itemBuilder: data.itemBuilder,
itemCount: data.itemCount,
padding: EdgeInsets.zero,
shrinkWrap: true, // This here will make the ListView wrap to content.
);
}
Widget _menuComponentBuilder(MenuComponentData data) {
return ClipRect(
child: Column(
mainAxisSize: MainAxisSize.min, // This will make the column wrap to content.
children: [data.listView],
),
);
}
SelectionMenu<Rectangle>(
componentsConfiguration: DropdownComponentsConfiguration(
listViewComponent: ListViewComponent(builder: _listViewBuilder),
menuComponent: MenuComponent(builder: _menuComponentBuilder,
),
// Other Properties...
);
I'm glad to see people are still using my work. Thank you. 🌟
I assume the issue was resolved, so I'm closing the issue.
Feel free to reopen the issue if the problem persists.
i did as you say, and its working now, sorry if this is a little bit out of topic, but how can i remove white padding around ListView?
I'll add such a feature in the next release (which might take some time.)
Currently, there is a workaround for this. Use AnimationComponent
.
You can copy the actual DropdownAnimationComponent
and edit this line of code.
is there a way to set height of the menu so that it can change dynamically depending on the size of the list of items inside it?