How to Solve ʺHorizontal viewport was given unbounded heightʺ Error in Flutter

In this example, we are going to show you how to fix the "Horizontal viewport was given unbounded height" error on the Flutter app. This error occurs when there is indefinite width of the widget or its parent widget.

Read This Also: How to solve ʺVertical viewport was given unbounded heightʺ Error on Flutter

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performResize():
Horizontal viewport was given unbounded height.
Viewports expand in the cross axis to fill their container and constrain their children to match
their extent in the cross axis. In this case, a horizontal viewport was given an unlimited amount of
vertical space in which to expand.

ListView(
  shrinkWrap: true,
  children: [
        
  ],
)

Container(
  width: 500,
  child:ListView(
      children: [
          
      ],
  ),
)

OR

SizedBox(
  width: MediaQuery.of(context).size.width,
  child:ListView(
      children: [
          
      ],
  ),
)

Expanded(
  child:ListView(
      children: [
          
      ],
  ),
)

In this way, you can Solve the "Horizontal viewport was given unbounded height" Error in Flutter.

No any Comments on this Article


Please Wait...