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

onChanged callback from ShadSelectForm does not trigger except we enabled the onChangedNullable #176

Closed
moshOntong-IT opened this issue Oct 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@moshOntong-IT
Copy link
Contributor

Steps to reproduce

  1. Disabled the onChangedNullable from SelectFormField
  2. enabled the onChanged with printing the selected value

Note not the ShadSelect

Expected results

The onChanged will be trigger

Actual results

Does not trigger the onChanged it needs to enabled the onChangedNullable

shadcn_ui version

0.13.5

Platform

Windows

Code sample

Code sample
  ShadSelectFormField(
                  id: 'email',
                  minWidth: 350,
                  initialValue: initialValue,
                  // onChanged: allowDeselection ? null : print,
                  // onChangedNullable: allowDeselection ? print : null,
                  onChanged: (v) {
                    print('onChanged: $v');
                  },
                  // onChangedNullable: (v) {
                  //   print('onChangedNullable: $v');
                  // },
                  options: verifiedEmails
                      .map((email) =>
                          ShadOption(value: email, child: Text(email)))
                      .toList(),
                  selectedOptionBuilder: (context, value) => value == 'none'
                      ? const Text('Select a verified email to display')
                      : Text(value),
                  placeholder: const Text('Select a verified email to display'),
                  validator: (v) {
                    if (v == null) {
                      return 'Please select an email to display';
                    }
                    return null;
                  },
                ),

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]
@moshOntong-IT moshOntong-IT added the bug Something isn't working label Oct 26, 2024
@moshOntong-IT
Copy link
Contributor Author

PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant