-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix TabController throws build scheduled during frame error #105442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TabController throws build scheduled during frame error #105442
Conversation
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix! Can you help me understand a bit better? Thanks!
9c2374b to
b2898c2
Compare
@Piinks While trying to write a detailed explanation for this PR, I found an easier fix. I put the draft explanation, I started to write, at the end of this comment for future reference. The issue happened only when switching from one tab to a non adjacent one (using So instead of fixing the consequences of jumping straight away to a non adjacent page (my previous fix), this new fix relies on the same solution used by existing code (jumping in two steps). Draft explanation for future reference. The TabBarView manages two controllers, a PageController and a TabController. TabController also owns an AnimationController. This AnimationController has several listeners :
When the user selects a new tab, _TabBarState_handleTap is called, the TabController selected index is updated (in _TabController_changeIndex) and the AnimationController owned by TabController is updated too. The PageController owned by TabBarView is also updated because it listens to the AnimationController. |
|
Thank you for the detailed break down! Very thorough! |
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b2898c2 to
cf359f5
Compare
Description
This PR fixes an exception (
Build scheduled during frame) thrown whenTabController.indexis updated andTabController.animationDurationis set toDuration.zero.See this comment #102600 (comment) for a reproducible code sample.
Related Issue
Fixes #102600
Tests
Adds 1 test.