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

ComboboxItem disabled property. #949

Closed
Piero512 opened this issue Oct 19, 2023 · 1 comment
Closed

ComboboxItem disabled property. #949

Piero512 opened this issue Oct 19, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Piero512
Copy link

Is your feature request related to a problem? Please describe.
I am in the process of creating a desktop app that has customizable options, and I wanted to show a greyed out combobox option that could not be selected, with an additional tooltip explaining why that item is not selectable.

Describe the solution you'd like
I would love that the ComboboxItem class be updated to carry a disabled/enabled property that would style the Text or any other widget of the Combobox item, so that item will tell the user that is not a selectable option, but it could be supported if circunstances change. Although that might not be in compliance with WinUI3 and stuff, so a similar class like CommandBarBuilderItem would be acceptable.

Describe alternatives you've considered
Trying to cancel the onTap on the Selected State and raising a dialog explaining why the option can't work. Displaying only the currently supported options.

In my specific case, I could just remove from the option selector, say, the use CUDA option if my code detects that there isn't an NVIDIA GPU installed.

Additional context
Add any other context or screenshots about the feature request here.

@bdlukaa bdlukaa added the enhancement New feature or request label Oct 19, 2023
@bdlukaa
Copy link
Owner

bdlukaa commented Oct 20, 2023

Added ComboboxItem.enabled. If you set it to false, the tap method is not invoked.

To create a custom combobox item, you can extend the ComboboxItem and override the build method.

final MyItem extends ComboboxItem {

  ...

  @override
  Widget build(BuildContext context) {
    return Tooltip(
      message: .....,
      child: super.build(context),
    );
  }

}

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

No branches or pull requests

2 participants