美文网首页
RepaintBoundary、RelayoutBoundary

RepaintBoundary、RelayoutBoundary

作者: liboxiang | 来源:发表于2019-08-01 17:36 被阅读0次

    RepaintBoundary

    • RepaintBoundary子树repaint的时候,父widget和RepaintBoundary子树会被repaint,但是与RepaintBoundary子树同级的其他子树不会被repaint
    • 如果父widget repaint,则RepaintBoundary子树也会repaint
    • 如果非RepaintBoundary子树repaint,则也会引起浮widget repaint,导致RepaintBoundary子树也repaint

    RelayoutBoundary

    renderObject在layout阶段做了Relayout boundary的优化,当子树进行relayout时,满足下面三种中的一种

    • parentUsesSize == false
    • sizedByParent == true
    • constraints.isTight
      那么该renderObject设置为Relayout boundary,也就是该renderObject的重新layout不触发parent的layout,一般情况下开发人员不需要关心Relayout boundary,除非是使用CustomMultiChildLayout

    相关文章

      网友评论

          本文标题:RepaintBoundary、RelayoutBoundary

          本文链接:https://www.haomeiwen.com/subject/bbdcdctx.html