Skip to content

Conversation

mpcomplete
Copy link
Contributor

The problem was that the Scaffold was getting a new key each time we
navigated to the main page. The key influences where page state is
stored, including the scroll offset. So for a single frame, the Scaffold
incorrectly thinks the scroll offset is 0 and the app bar should be
expanded.

BUG=#4400

@mpcomplete
Copy link
Contributor Author

cc @Hixie This is super subtle and took me rifling through the sources to figure out the fix. Is it intended that the Scaffold key could affect something like this? If so, I think we need to explain keys a bit better (I still don't quite get when I need to supply them.)

@HansMuller
Copy link
Contributor

LGTM

The problem was that the Scaffold was getting a new key each time we
navigated to the main page. The key influences where page state is
stored, including the scroll offset. So for a single frame, the Scaffold
incorrectly thinks the scroll offset is 0 and the app bar should be
expanded.

BUG=#4400
@Hixie
Copy link
Contributor

Hixie commented Jun 15, 2016

The key is the object's identity. If you provide the scaffold with a new key, you're saying "this is an entirely new scaffold unrelated to any earlier scaffolds". So yes, this resets its state and so forth.

I agree we need more docs on this. Feel free to file a bug on that. File bugs on anything you get trouble with, even if it's just asking for docs.

@mpcomplete mpcomplete merged commit 02a4483 into flutter:master Jun 16, 2016
@mpcomplete mpcomplete deleted the appbarheight branch June 16, 2016 21:24
cdotstout pushed a commit to cdotstout/flutter that referenced this pull request Apr 3, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants