Added onChangeStart and onChangeEnd to CupertinoSlider#17535
Added onChangeStart and onChangeEnd to CupertinoSlider#17535gspencergoog merged 12 commits intomasterfrom unknown repository
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
I signed it! |
|
CLAs look good, thanks! |
… and onChangeEnd documentation
|
Thanks @dcaraujo0872! This looks great, but could we bother you to add a test for it too? |
|
Sure thing @gspencergoog, on it. :) |
| widget.onChangeEnd(_lerp(value)); | ||
| } | ||
|
|
||
| // Returns a number between min and max, proportional to value, which must |
There was a problem hiding this comment.
The indentation is off here.
| /// | ||
| /// ```dart | ||
| /// new CupertinoSlider( | ||
| /// value: _duelCommandment.toDouble(), |
There was a problem hiding this comment.
You'll need to add the magic comment incantation:
// Examples can assume:
// int _duelCommandment = 1;at the top of the file, just below the imports (see the top of material/slider.dart for an example) to prevent the dartdoc syntax checker from failing.
There was a problem hiding this comment.
Sorry, I gave you only partially correct advice: you need that incantation, but you'll have to change the name of the variable, since that name is already used in the material slider.
Maybe something like _cupertinoSliderValue. More boring, but has the advantage of being unique. :-)
There was a problem hiding this comment.
Doh! Well my own fault as well because I didn't check other source files. I saw the CI logs a few minutes ago and was wondering why it was failing. Thanks @gspencergoog :)
| double _lerp(double value) { | ||
| assert(value >= 0.0); | ||
| assert(value <= 1.0); | ||
| return value * (widget.max - widget.min) + widget.min; |
There was a problem hiding this comment.
You can just replace calls to _lerp with this (and eliminate _lerp):
lerpDouble(widget.min, widget.max, value);The 0-1 enforcement is already being done in the render object.
…no-slider-onchangestart

This is a follow up on issue #17169 and the pull request #17298
This pull request adds the onChangeStart and onChangeEnd callbacks for CupertinoSlider. These are called when a user starts and ends a change respectively.