flutter_multiselect icon indicating copy to clipboard operation
flutter_multiselect copied to clipboard

onSaved method is not working

Open WilliBobadilla opened this issue 5 years ago • 0 comments

when I try to save data, onSaved is not working, I put some prints inside to verify, and is nos executing the function. So I edit the libreary locally and added one link in the onTap listener of the InkWell in the flutter_multiselect.dart, as follow:

 return InkWell(
                  onTap: () async {
                    var results = await Navigator.push(
                        state.context,
                        MaterialPageRoute<dynamic>(
                          builder: (BuildContext context) => SelectionModal(
                              filterable: filterable,
                              valueField: valueField,
                              textField: textField,
                              dataSource: dataSource,
                              values: state.value ?? []),
                          fullscreenDialog: true,
                        ));

                    if (results != null) {
                      if (results.length > 0) {
                        state.didChange(results);
                      } else {
                        state.didChange(null);
                      }
                      print('selected value $results');
                      onSaved(
                          results); //added to listen the chaneges on the onSaved method
                    }
                  },

and it works for me! :+1:

WilliBobadilla avatar Feb 05 '21 23:02 WilliBobadilla