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

Example using initialValue in MultiSelectDialogField #7

Closed
Aynn opened this issue Nov 1, 2020 · 1 comment
Closed

Example using initialValue in MultiSelectDialogField #7

Aynn opened this issue Nov 1, 2020 · 1 comment

Comments

@Aynn
Copy link

Aynn commented Nov 1, 2020

I have been struggling a bit getting initial value to work, could someone provide an example?

I don't see it being used in any of the examples in the repository.

@CHB61
Copy link
Owner

CHB61 commented Dec 1, 2020

Hi @Aynn,

I'm sorry to respond so late.

I have updated the example project to include a MultiSelectDialogField that has initial values set.

Here is an example:

MultiSelectBottomSheetField(
  items: _animalItems,
  initialValue: _selectedAnimals // set this in initState for pre-selected values,
  onConfirm: (values) {
    _selectedAnimals = values;
  },
  chipDisplay: MultiSelectChipDisplay(
    onTap: (item) {
      _selectedAnimals.remove(item);
      return _selectedAnimals;
    },
  ),
),

Hope this helps :)

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