• chunhtai's avatar
    Revert selectable update back to be a postframecallback or microtask (#125140) · 14e191fa
    chunhtai authored
    The regression was caused by the previous pr https://github.com/flutter/flutter/pull/124624 changes postframecallback to scheduleframecallback. The reason is that if a new postframecallback was scheduled when running a postframecallback. The newly added postframecallback will be execute on the next frame. However, adding postframecallback will not schedule a new frame. So if there isn't other widget that schedule a new frame, the newly added postframecallback will never gets run.
    
    After changing to scheduleframecallback, it causes an issue that transient callback may be called when rendering tree contains dirty layout information that are waiting to be rebuilt.
    
    Therefore, I use microtask to get around of the postframecallback issue instead of scheduleframecallback.
    
    fixes https://github.com/flutter/flutter/issues/125065
    14e191fa
selectable_region.dart 83.7 KB