title: How to have dynamic height in CustomMultiChildLayout?
body: <p>I created a <code>CustomMultiChildLayout</code> in order to customize the positions of its children. Then tried to put <code>CustomMultiChildLayout</code> into a <code>Container</code>, with <code>BoxConstraints(maxHeight: 500)</code>, then the <code>CustomMultiChildLayout</code> has always the maxHeight 500 as height. It cannot adjust its height according to its children.</p>
  
  <p>So how can I have dynamic height for my <code>CustomMultiChildLayout</code>? If this is not possible, are there any other ways to implement this layout?</p>
  
  <p><strong>Background:</strong></p>
  
  <p>I defined 3 widgets, each of them is a <code>Container</code>, and I need to customize their positions.</p>
  
  <p>SellerWidget should be positioned in the middle of two other widgets. </p>
  
  <p>Please refer to this image: <a href="https://i.stack.imgur.com/Bbvxi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Bbvxi.png" alt="enter image description here"></a></p>
  
  <p>Here's my code:</p>
  
  <pre><code>class ProductComboWidget extends StatelessWidget {
  
      final Product _product;
  
      ProductComboWidget(this._product);
  
      @override
      Widget build(BuildContext context) {
          return Container(
              constraints: BoxConstraints(maxHeight: 500),
              child: CustomMultiChildLayout(
                  delegate: _TitleInfoLayout(),
                  children: &lt;Widget&gt;[
                      LayoutId(
                          id: _TitleInfoLayout.title,
                          child: ProductTitleWidget(_product)
                      ),
                      LayoutId(
                          id: _TitleInfoLayout.info,
                          child: ProductInfoWidget(_product)
                      ),
                      LayoutId(
                          id: _TitleInfoLayout.seller,
                          child: SellerWidget(_product.seller)
                      ),
                  ],
              ),
          );
      }
  
  }
  
  class _TitleInfoLayout extends MultiChildLayoutDelegate {
  
      static const String title = 'title';
      static const String info = 'info';
      static const String seller = 'seller';
  
      @override
      void performLayout(Size size) {
          final Size titleSize = layoutChild(title, BoxConstraints(maxWidth: size.width));
          positionChild(title, Offset(0, 0));
  
          layoutChild(info, BoxConstraints(maxWidth: size.width));
          positionChild(info, Offset(0, titleSize.height));
  
          final Size sellerSize = layoutChild(seller, BoxConstraints());
          positionChild(seller, Offset(size.width - sellerSize.width - 20, titleSize.height - sellerSize.height / 2));
      }
  
      @override
      bool shouldRelayout(MultiChildLayoutDelegate oldDelegate) {
          return true;
      }
  
  }
  </code></pre>
  
  <p><strong>Actual result:</strong></p>
  
  <p>The height of <code>CustomMultiChildLayout</code> always equals to BoxConstraint.maxHeight, it cannot adjust its height according to its children.</p>
  
  <p>Please refer to this image: <a href="https://i.stack.imgur.com/x2BMX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/x2BMX.png" alt="enter image description here"></a></p>
  
  <p>There is a useless empty space on the bottom of this widget.</p>
  
  <p><strong>Expected result:</strong></p>
  
  <p>Have its height adapted to its children, like other widgets.</p>