-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQUEST] - Wrap items of SearchChoices.multiple() widget #109
Comments
Hello @ramioooz , Thank you very much for your message and request! I believe this is covered by the SearchChoices.multiple(
items: items,
selectedItems: selectedItemsMultiDialogWithCountAndWrap,
hint: "Select items",
searchHint: "Select items",
onChanged: (value) {
setState(() {
selectedItemsMultiDialogWithCountAndWrap = value;
});
},
isExpanded: true,
selectedValueWidgetFn: (item) {
return (Container(
margin: const EdgeInsets.all(15.0),
padding: const EdgeInsets.all(3.0),
decoration:
BoxDecoration(border: Border.all(color: Colors.blueAccent)),
child: Text(
item,
overflow: TextOverflow.ellipsis,
),
));
},
selectedAggregateWidgetFn: (List<Widget> list) {
return (Column(children: [
Text("${list.length} items selected"),
Wrap(children: list),
]));
},
) With this result: Cheers! |
Hello @lcuis ,
My Regards. |
Oh, indeed, sorry, let me check. |
Indeed, for this to work easily, there would need to be an additional callback to replace the search_choices/lib/src/dropdown/dropdown_dialog.dart Lines 713 to 748 in 6c6a430
Thanks for mentioning this! I hope this can be done soon. |
@lcuis there is something like this being done here: |
not really. the example display selected items in a wrap. we can do that in your widget using
the photos attaches show the current result and the wanted result. Thank you. |
Thanks @Macacoazul01 for the link. This is an interesting project. Thanks @ramioooz for the additional explanation and examples. |
Hi @ramioooz , Here is an example with the upcoming new parameter searchResultDisplayFn: ({
required List<Tuple3<int, DropdownMenuItem, bool>> itemsToDisplay,
required ScrollController scrollController,
required bool thumbVisibility,
required Widget emptyListWidget,
required void Function(int index, dynamic value, bool itemSelected)
itemTapped,
required Widget Function(DropdownMenuItem item, bool isItemSelected)
displayItem,
}) {
return Expanded(
child: itemsToDisplay.length == 0
? emptyListWidget
: SingleChildScrollView(
child: Wrap(
spacing: 10,
children: itemsToDisplay.map(
(Tuple3<int, DropdownMenuItem, bool> item) {
return Padding(
padding:
const EdgeInsets.symmetric(vertical: 8.0),
child: InkWell(
onTap: () {
itemTapped(
item.item1,
item.item2.value,
item.item3,
);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
width: 5,
)),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8.0),
child: item.item2,
),
],
),
),
),
);
},
).toList()),
));
}, I will commit and publish as soon as possible. |
Release 2.2.4 has just been published to pub.dev with the previously mentioned new parameter. |
Hello @lcuis I can't thank you enough for putting the effort into bringing the idea into the material world.
Thank you very much |
Thanks a lot @ramioooz for the confirmation and for your message! Enjoy! |
Hello developers.
First I would like to thank you very much for providing such a nice and smart widget.
I have a suggestion for a feature here.
for the SearchChoices.multiple() widget.
we wanted to be able to have the items in the multichoice list to be displayed in a wrap/grid.
the only available option now is to have the items displayed in a list.
please have a look over my attached image to give you an idea about what we want.
we would like to have the items of SearchChoices.multiple() to be displayed in a wrap. something similar to what is shown in the second drawing in the image attached.
My regards.
Rami
The text was updated successfully, but these errors were encountered: