Fix TabController throws build scheduled during frame error#105442
Conversation
Piinks
left a comment
There was a problem hiding this comment.
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! |
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.