Launching lib/main.dart on iPad Pro (9.7-inch) in debug mode...
Running Xcode build...
Xcode build done. 42.7s
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown during layout:
flutter: A RenderFlex overflowed by 312 pixels on the right.
flutter:
flutter: User-created ancestor of the error-causing widget was:
flutter: Card file:///Users/dreamtouch/zqy/projects/pavlova/lib/main.dart:150:18
flutter:
flutter: The overflowing RenderFlex has an orientation of Axis.horizontal.
flutter: The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
flutter: black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
flutter: Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
flutter: RenderFlex to fit within the available space instead of being sized to their natural size.
flutter: This is considered an error condition because it indicates that there is content that cannot be
flutter: seen. If the content is legitimately bigger than the available space, consider clipping it with a
flutter: ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
flutter: like a ListView.
flutter: The specific RenderFlex in question is: RenderFlex#af837 relayoutBoundary=up10 OVERFLOWING:
flutter: creator: Row ← Semantics ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
flutter: _InkFeatures-[GlobalKey#36077 ink renderer] ← NotificationListener<LayoutChangedNotification> ←
flutter: CustomPaint ← _ShapeBorderPaint ← PhysicalShape ← _MaterialInterior ← Material ← Padding ← ⋯
flutter: parentData: <none> (can use size)
flutter: constraints: BoxConstraints(0.0<=w<=1016.0, h=592.0)
flutter: size: Size(1016.0, 592.0)
flutter: direction: horizontal
flutter: mainAxisAlignment: start
flutter: mainAxisSize: max
flutter: crossAxisAlignment: start
flutter: textDirection: ltr
flutter: verticalDirection: down
flutter: ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
Syncing files to device iPad Pro (9.7-inch)...
从上面错误输出信息可以看到,整体宽度溢出了312个像素(A RenderFlex overflowed by 312 pixels on the right)。为什么是312个像素呢?我们来分析一步步分析下。首先我们选择的设备是 iPad Pro (9.7-inch) ,它的逻辑分辨率是1024*768,我们从Flutter Inspector里也可以看到:
尝试用上述的方法2和方法3,解决显示溢出问题。可以参考控制台输出的提示:"If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView."