title: How can I deal with rendering error of ListView in flutter
body: <p>In my screen, I have a column and the column has a ListView and a textfield.<br>
  It's like a chat with a NPC, so if the users enter all of the answers, the textfield is changed into button.<br>
  At this point, rendering error is occurred and I don't know what the problem is.</p>
  
  <p>Here is how it looks:  </p>
  
  <p><a href="https://i.stack.imgur.com/rA1f8.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rA1f8.gif" alt="What I&#39;m doing in gif"></a></p>
  
  <p>Partial code of my implementation is below.</p>
  
  <pre><code>return Column(
    children: &lt;Widget&gt;[
      Flexible(
        child: ListView.builder(
          scrollDirection: Axis.vertical,
          physics: const AlwaysScrollableScrollPhysics(),
          padding: const EdgeInsets.symmetric(horizontal: 20.0,vertical: 30.0),
          itemCount: widgets.length,
          itemBuilder: (context,index) =&gt; widgets[index],
          controller: _scrollController,
        ),
      ),
      state.showSubmitButton 
      ? Padding(
          padding: const EdgeInsets.only(bottom: 20.0),
          child: PrimaryButton(
            color: primaryBeige,
            text: 'Submit',
            callback: ()=&gt;_tagChatBloc.emitEvent(TagChatEventComplete())
          )
        ) 
      : (state.isDetailStoreLoading 
        ? Padding(
            padding: const EdgeInsets.only(bottom: 20.0),
            child: CustomProgressIndicator()
          )
        : TagChatInput(scrollController: _scrollController)
      )
    ],
  );
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>I/flutter (32685): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
    I/flutter (32685): The following assertion was thrown during performLayout():
    I/flutter (32685): A RenderViewport exceeded its maximum number of layout cycles.
    I/flutter (32685): RenderViewport render objects, during layout, can retry if either their slivers or their
    I/flutter (32685): ViewportOffset decide that the offset should be corrected to take into account information collected
    I/flutter (32685): during that layout.
    I/flutter (32685): In the case of this RenderViewport object, however, this happened 10 times and still there was no
    I/flutter (32685): consensus on the scroll offset. This usually indicates a bug. Specifically, it means that one of the
    I/flutter (32685): following three problems is being experienced by the RenderViewport object:
    I/flutter (32685):  * One of the RenderSliver children or the ViewportOffset have a bug such that they always think
    I/flutter (32685):    that they need to correct the offset regardless.
    I/flutter (32685):  * Some combination of the RenderSliver children and the ViewportOffset have a bad interaction such
    I/flutter (32685):    that one applies a correction then another applies a reverse correction, leading to an infinite
    I/flutter (32685):    loop of corrections.
    I/flutter (32685):  * There is a pathological case that would eventually resolve, but it is so complicated that it
    I/flutter (32685):    cannot be resolved in any reasonable number of layout passes.</p>
  </blockquote>
  
  <p>How can I solve this problem?</p>