-
-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Form data in onChanged of the StacSlider is set after running Stac.onCallFromJson. This leads to old data if form data is directly used in the onChanged action of the slider.
Fix is easy and straight forward in:
packages/stac/lib/src/parsers/widgets/stac_slider/stac_slider_parser.dart
Actual code (line 49 to 58):
void _onChanged(double value) {
selectedValue = value;
if (widget.model.onChanged != null) {
Stac.onCallFromJson(widget.model.onChanged, context);
}
if (widget.model.id != null) {
widget.formScope?.formData[widget.model.id!] = value;
}
setState(() {});
}
To fix the behaviour just reorder the two if's:
void _onChanged(double value) {
selectedValue = value;
if (widget.model.id != null) {
widget.formScope?.formData[widget.model.id!] = value;
}
if (widget.model.onChanged != null) {
Stac.onCallFromJson(widget.model.onChanged, context);
}
setState(() {});
}
I can make a pull request if you want, but I think the fix is too easy.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working