Added 'physics' prop to Stepper.#26297
Conversation
Added 'physics' prop which allows the developer to assign the Stepper's scroll view's 'ScrollPhysics' which can solve with unwanted scrolling behaviour if the parent is also a scroll view. Defaults to 'AlwaysScrollableScrollPhysics' if null.
|
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! |
Removed unnecessary import and defaulting to 'AlwaysScrollableScrollPhysics' if physics prop is null.
|
Analysis is still unhappy because of whitespace at the end of a line - can you fix that up? |
|
Can you add a test that fails without this change? e.g. a test that shows how you're able to get rid of the unwanted scrolling behavior you mention |
Ran through format to remove unwanted whitespace which Analysis isn't happy about.
|
Ran it through the VSCode Format command so hope that solved the whitespace issue. I'm not sure how to create a unit test to demonstrate why I'm proposing this PR but let's say we have a ListView including a Stepper: ListView(
children: <Widget>[
Text('long text'),
Stepper(
//stuff here
),
Text('more long text'),The ListView within the Stepper will mess with the parent ListView resulting in the user being unable to scroll down the page: With adding a ListView(
children: <Widget>[
Text('long text'),
Stepper(
physics: ClampingScrollPhysics(),
//other stuff here
),
Text('more long text'),You could achieve this using a |
|
We don't really have a lot of success with dartfmt on this repo, unfortunately. It does some strange things with linebreaks that don't fit with the style of the repo. VSCode actually has a setting to trim whitespace for you: Can you revert the dartfmt for this and reapply your other changes? As far as a test goes, you should be able to create a |
Tried reformatting again.
Tried reformatting again.
Formatting again why do you hate me github editor.
if this format doesn't work i'll cry
Added Stepper scroll tests. One that fails to find Text after Stepper if physics left as null and one that succeeds if physics set to `ClampingScrollPhysics()`
|
Okay got the format right (finally) and added tests. Let me know if these are acceptable and thanks for helping (you can really tell this is my first PR to a Google project). |
Added const constructors
trying to get rid of whitespace again
why whitespace why
Swapped to `findsNothing` because I'm an idiot.
|
Sorry this has taken so long to reach the finish line! I'm going to fix up the last formatting problems and a note to the Thanks again for your contribution! |
|
Can we get the Stepper's physics to also be implemented for |
|
Temp solution is to add: |



Added 'physics' prop which allows the developer to assign the Stepper's scroll view's 'ScrollPhysics' which can solve with unwanted scrolling behaviour if the parent is also a scroll view.
Fixes #19513