title: How to get height of a Widget?
body: <p>I don't understand how <code>LayoutBuilder</code> is used to get the height of a Widget. </p>
  
  <p>I need to display the list of Widgets and get their height so I can compute some special scroll effects. I am developing a package and other developers provide widget (I don't control them). I read that LayoutBuilder can be used to get height. </p>
  
  <p>In very simple case, I tried to wrap Widget in LayoutBuilder.builder and put it in the Stack, but I always get <code>minHeight</code> <code>0.0</code>, and <code>maxHeight</code> <code>INFINITY</code>. Am I misusing the LayoutBuilder?</p>
  
  <p><strong>EDIT</strong>: It seems that LayoutBuilder is a no go. I found the <a href="https://docs.flutter.io/flutter/widgets/CustomSingleChildLayout-class.html" rel="noreferrer">CustomSingleChildLayout</a> which is almost a solution. </p>
  
  <p>I extended that delegate, and I was able to get the height of widget in <code>getPositionForChild(Size size, Size childSize)</code> method. BUT, the first method that is called is <code>Size getSize(BoxConstraints constraints)</code> and as constraints, I get 0 to INFINITY because I'm laying these CustomSingleChildLayouts in a ListView.</p>
  
  <p>My problem is that SingleChildLayoutDelegate <code>getSize</code> operates like it needs to return the height of a view. I don't know the height of a child at that moment. I can only return constraints.smallest (which is 0, the height is 0), or constraints.biggest which is infinity and crashes the app.</p>
  
  <p>In the docs it even says: </p>
  
  <blockquote>
    <p>...but the size of the parent cannot depend on the size of the child.</p>
  </blockquote>
  
  <p>And that's a weird limitation.</p>