Skip to content

Conversation

@passsy
Copy link
Contributor

@passsy passsy commented Jun 16, 2020

Increate cell size with each index by 1

  • Flutter
  • iOS
  • Android

It turned out that different sized cells cause a different scrolling behavior on iOS (flutter/flutter#32448). This change allows testing this scenario.

  • Recreate ancient android project which wasn't compiling
  • Reduce Android divider height to 0 to better align with Flutter rendering

passsy added 2 commits June 17, 2020 01:32
The android project hasn't been updated in a long time and wasn't compiling. Was recreated using `flutter create`, sample code was added afterwards
Different sized items cause a completely different scrolling behavior (which is what's often found in the real world). Especially on iOS this causes the damping is now much more noticeable than on native. flutter/flutter#32448
passsy added a commit to passsy/flutter that referenced this pull request Jul 8, 2020
…items

As pointed out in flutter#32448, the velocity shouldn't be decreased when creating the simulation. The current solution only works for lists where all items have the same size. Lists with different sized items recreate the simulation over and over again (because the maxScrollExtent slightly changes), reducing the velocity with each call by 9%. The velocity should not depend on how often the simulation gets created!
Instead I tweaked the damping value of the FrictionSimulation to match the native behavior more closely.

For testing, I updated the [scroll_overlay](flutter/platform_tests#2) test project to use different sized cells.

The new damping isn't pixel-perfect. I'm not even sure it is possible at all. But at least lists with equally and unequally sized cells now behave the same.

Related flutter#11772
@passsy
Copy link
Contributor Author

passsy commented Aug 12, 2020

@LongCatIsLooong wanna merge this PR?

@LongCatIsLooong
Copy link

@passsy Sorry for the delay! I'll take a look at the iOS part this weekend.

Copy link

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dart and ios LGTM. @xster could you take a look at this?

@xster
Copy link
Member

xster commented Aug 24, 2020

Thanks for bringing this project up to date. Could you add a screenshot for before and after?

@passsy
Copy link
Contributor Author

passsy commented Aug 24, 2020

Before After

The items now increase by 1 logical pixel with each item.

@passsy
Copy link
Contributor Author

passsy commented Aug 24, 2020

Note

The iOS scrolling is broken on Flutter (Channel master, 1.22.0-2.0.pre.36, on Mac OS X 10.15.6 19G2021, locale en-GB). Fling doesn't work and scrolling is ~4x slower.

git bisect pointed to flutter/flutter@be9bc8c where the bug was introduced

@xster
Copy link
Member

xster commented Aug 24, 2020

uh oh, that's concerning. Do we have a bug for this issue?

@passsy
Copy link
Contributor Author

passsy commented Aug 24, 2020

False alarm, my bad. Everything works after flutter clean.

@InMatrix
Copy link

Just tried this PR today for a demo. It worked very well. Since there is already an approval from @LongCatIsLooong for the PR, I'm merging this. Thank you for your contribution, @passsy.

@InMatrix InMatrix merged commit c86b720 into flutter:master Oct 17, 2020
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

Successfully merging this pull request may close these issues.

4 participants