[Solved] Flutter BoxConstraints forces an infinite height

2022/08/11 16:45

Exception

======== Exception caught by rendering library =====================================================

The following assertion was thrown during performLayout():

BoxConstraints forces an infinite height.

These invalid constraints were provided to RenderFlex’s layout() function by the following function, which probably computed the invalid constraints in question:

RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:277:14)

The offending constraints were: BoxConstraints(w=124.3, h=Infinity)

The relevant error-causing widget was:

SizedBox.expand SizedBox:file:///C:/Users/Eddy/StudioProjects/kidmath/lib/math/addition_page.dart:385:32

When the exception was thrown, this was the stack:

#0      BoxConstraints.debugAssertIsValid.<anonymous closure>.throwError (package:flutter/src/rendering/box.dart:516:9)

#1      BoxConstraints.debugAssertIsValid.<anonymous closure> (package:flutter/src/rendering/box.dart:560:11)

#2      BoxConstraints.debugAssertIsValid (package:flutter/src/rendering/box.dart:564:6)

#3      RenderObject.layout (package:flutter/src/rendering/object.dart:1784:24)

#4      RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:277:14)

#5      RenderObject.layout (package:flutter/src/rendering/object.dart:1887:7)

#6      ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:56:11)

Error

You should use Expanded widget within Row(), Column(), or Flex().

Leave a Reply

Back to top