title: Flutter : How to avoid specifying absolute height to Container
body: <p>I am wrapping a Container over GridView with Axis as Horizontal.
  I need to specify a absolute height for the same, which I want to avoid, because my child widget of GridView will scale as per device pixels and accordingly  the wrapper Container should expand. Please find below code :</p>
  <pre><code>Container(
            height: 416,
            child: GridView.count(
                padding: EdgeInsets.fromLTRB(kGroupPadding, spacing,kGroupPadding,spacing),
                mainAxisSpacing: GutterSpacing.spacing10,
                crossAxisSpacing: GutterSpacing.spacing10,
                crossAxisCount: itemsLength &gt; 5 ? 2 : 1,
                shrinkWrap: true,
                childAspectRatio: GutterRatio.ratio1_35,
                scrollDirection: Axis.horizontal,
                primary: false,
                children: [for (var item in model.items) builder(context,item as cm.LockableItem)]),
          ),
  </code></pre>
  <p>I tried wrapping GridView with AspectRatio, but the ratio specified works for iphone causes issue for xhdpi ad xxhdpi Android devices.</p>
  <pre><code>AspectRatio(
            aspectRatio: 0.92,
            child: GridView.count(
                padding: EdgeInsets.fromLTRB(kGroupPadding, spacing,kGroupPadding,spacing),
                mainAxisSpacing: GutterSpacing.spacing10,
                crossAxisSpacing: GutterSpacing.spacing10,
                crossAxisCount: itemsLength &gt; 5 ? 2 : 1,
                shrinkWrap: true,
                childAspectRatio: GutterRatio.ratio1_35,
                scrollDirection: Axis.horizontal,
                primary: false,
                children: [for (var item in model.items) builder(context,item as cm.LockableItem)]),
          ),
  </code></pre>
  <p>Also tried wrapping GridView with IntrinsicHeight, Expanded but there is a runtime exception as it fails to render the widget because size property isn't mentioned.</p>
  <pre><code>    ======== Exception caught by scheduler library =====================================================
  The following assertion was thrown during a scheduler callback:
  Updated layout information required for _RenderScrollSemantics#3b8da NEEDS-LAYOUT NEEDS-PAINT to calculate semantics.
  'package:flutter/src/rendering/object.dart':
  Failed assertion: line 2741 pos 12: '!_needsLayout'
  
  
  Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
  In either case, please report this assertion by filing a bug on GitHub:
    https://github.com/flutter/flutter/issues/new?template=2_bug.md
  
  When the exception was thrown, this was the stack: 
  #2      RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2741:12)
  #3      RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #4      RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #5      RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #6      RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #7      RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #8      ContainerRenderObjectMixin.visitChildren (package:flutter/src/rendering/object.dart:3406:14)
  #9      RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #10     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #11     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #12     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #13     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #14     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #15     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #16     ContainerRenderObjectMixin.visitChildren (package:flutter/src/rendering/object.dart:3406:14)
  #17     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #18     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #19     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #20     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #21     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #22     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #23     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #24     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #25     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #26     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #27     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #28     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #29     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #30     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #31     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #32     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #33     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #34     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #35     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #36     ContainerRenderObjectMixin.visitChildren (package:flutter/src/rendering/object.dart:3406:14)
  #37     RenderSliverMultiBoxAdaptor.visitChildrenForSemantics (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:398:11)
  #38     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #39     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #40     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #41     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #42     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #43     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #44     Iterable.forEach (dart:core/iterable.dart:279:35)
  #45     RenderViewportBase.visitChildrenForSemantics (package:flutter/src/rendering/viewport.dart:222:10)
  #46     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #47     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #48     RenderIgnorePointer.visitChildrenForSemantics (package:flutter/src/rendering/proxy_box.dart:3324:14)
  #49     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #50     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #51     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #52     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #53     RenderSemanticsAnnotations.visitChildrenForSemantics (package:flutter/src/rendering/proxy_box.dart:4721:11)
  #54     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #55     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #56     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #57     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #58     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #59     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #60     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #61     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #62     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #63     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #64     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #65     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #66     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #67     RenderObject._getSemanticsForParent.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:2753:61)
  #68     RenderObjectWithChildMixin.visitChildren (package:flutter/src/rendering/object.dart:3122:14)
  #69     RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2830:5)
  #70     RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2751:5)
  #71     RenderObject._updateSemantics (package:flutter/src/rendering/object.dart:2719:41)
  #72     PipelineOwner.flushSemantics (package:flutter/src/rendering/object.dart:1074:16)
  #73     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:502:21)
  #74     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
  #75     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
  #76     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
  #77     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
  #78     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
  #82     _invoke (dart:ui/hooks.dart:150:10)
  #83     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
  #84     _drawFrame (dart:ui/hooks.dart:114:31)
  (elided 5 frames from class _AssertionError and dart:async)
  </code></pre>
  <p>Thanks in advance for any solutions / suggestions</p>