Fix a Tabs crash when change the TabControllers#98242
Fix a Tabs crash when change the TabControllers#98242fluttergithubbot merged 3 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Switching the key like this is a little hacky. It often comes with other problems like state-loss in the children because they'll also be re-instantiated.
There was a problem hiding this comment.
If the view metrics become larger, the scrolling will be divided into two stages, the second stage occurs in the layout stage, which will trigger a notification and then cause an exception.
In fact, we can ignore the scroll notification for the scrolling of this scene.
There was a problem hiding this comment.
uber-nit: change this and below to _warpUnderwayCount += 1; for consistency with the rest of the file.
There was a problem hiding this comment.
nit: make showLast a (required) named parameter. This makes the code below a little more readable as you can see what parameter is set to true/false.
Fixes #97441
(#94339) If the
TabControllerchanged, we will call_pageController.jumpToPageto change the view position.But if the old pageView's metrics are small than the new controller index, it will abnormal.
My solution
If the controller changes, inflate a new
PageViewelement with the initial index.