Skip to content
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

onTap function doesn't work #49

Closed
EbrahimMosaaed opened this issue Sep 13, 2021 · 4 comments
Closed

onTap function doesn't work #49

EbrahimMosaaed opened this issue Sep 13, 2021 · 4 comments

Comments

@EbrahimMosaaed
Copy link

items: dropdownElemnts?.data?.sectors!.map((Sector value) { return DropdownMenuItem<String>( onTap: () { print('clicked'); }, value: value.id.toString(), child: Text(value.name!), ); }).toList(),

Actually i have two issues the first one ,the search feature doesn't work when the value and child pramters take different values as shown..with the below code search feature will work
value: value.name, child: Text(value.name!),

the second issue onTap function doesn't work at all

@lcuis
Copy link
Owner

lcuis commented Sep 14, 2021

Hello @EbrahimMosaaed ,

For the onTap not working on the item, I am not surprised this doesn’t work. Though, this may be an interesting improvement. If the onTap of the item is not null, the widget could execute it.

For the search working on the item value string, maybe this issue would help you:
#37 (comment)

lcuis added a commit that referenced this issue Sep 14, 2021
* Calling non future items onTap if not null when list item is tapped. Thanks @EbrahimMosaaed #49
* Fixed some typos.
* Added the following example code to the README: Multi dialog paged future
lcuis added a commit that referenced this issue Sep 14, 2021
* Calling non future items onTap if not null when list item is tapped. Thanks @EbrahimMosaaed #49
* Fixed some typos.
* Added the following example code to the README: Multi dialog paged future
@lcuis
Copy link
Owner

lcuis commented Sep 14, 2021

Hello @EbrahimMosaaed ,

Here is an example working for the onTap with the latest plugin version 2.0.8:

          String printable=new String.fromCharCodes(wordPair.characters.map<int>((element)=>element.codeUnitAt(0)).toList());
          items.add(DropdownMenuItem(
            child: Text(wordPair),
            value: wordPair,
            onTap: (){print("You tapped $printable !!!");},
          ));

This only works with non future items.

@EbrahimMosaaed
Copy link
Author

@lcuis
onTap function works perfectly fine, with the latest version 2.0.8.

Thanks .👍

@lcuis
Copy link
Owner

lcuis commented Sep 14, 2021

You're welcome @EbrahimMosaaed !
Thanks to you for the request and the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants