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

Confirmation override #4

Closed
brettpappas opened this issue Feb 18, 2020 · 3 comments
Closed

Confirmation override #4

brettpappas opened this issue Feb 18, 2020 · 3 comments

Comments

@brettpappas
Copy link

I am trying to customize the confirmation widget using confirmationBuilder but I can't seem to get the right syntax. Is there an example anywhere that does this?

https://pub.dev/documentation/smart_select/latest/smart_select/SmartSelectModalConfirmationBuilder.html

Here is what I am attempting:

modalConfig: SmartSelectModalConfig(
  useConfirmation: true,
  confirmationBuilder: (context, () {
    return InkWell(
      child: Text('Send'),
      onTap: () {},
    );
  })
),
@davigmacode
Copy link
Owner

Pardon me this case is not yet covered by the example, i will update the example soon.

Currently the confirmationBuilder syntax is

Widget SmartSelectModalConfirmationBuilder(
  BuildContext context,
  Function onConfirm
)

Ok, i get wrong at the onConfirm function, this confusing, but actually this function is supplied to the confirmationBuilder to confirm the selected choices and close the modal when the widget created by the confirmationBuilder tapped, so in your case it could be

modalConfig: SmartSelectModalConfig(
  useConfirmation: true,
  confirmationBuilder: (context, onConfirm) {
    return InkWell(
      child: Text('Send'),
      onTap: () => onConfirm(),
    );
  }
),

In the next version i will change onConfirm to closeModal, and the function should have parameter bool confirmed, and maybe i should supply current state of the selected choice so we can add some validation before confirm the selected choice and close the modal

@brettpappas
Copy link
Author

Thanks! That worked. It would be great to supply the current state since what I really would like to do is disable the "Send" button until an option has been chosen.

This plugin is an essential plugin for all of my flutter projects. Thanks so much for all your work on it.

@vasilich6107
Copy link

I released https://pub.dev/packages/flutter_awesome_select with fixed null safety.
Could you check that everything works for you?

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

3 participants