我正在开发一个应用程序,其中包含大量的wordpress文章。 我的问题是:我希望每个容器的长度大于宽度,但不能从正方形更改。
我也遇到以下错误:
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY
╞═════════════════════════════════════════════════════════
flutter: The following message was thrown during layout:
flutter: A RenderFlex overflowed by 5.9 pixels on the bottom.
flutter:
flutter: The overflowing RenderFlex has an orientation of Axis.vertical.
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:
flutter: RenderFlex#b5cf8 OVERFLOWING
flutter: creator: Column ← DecoratedBox ← Padding ← Container ← RepaintBoundary-[<0>] ←
flutter: NotificationListener<KeepAliveNotification> ← KeepAlive ← AutomaticKeepAlive ← SliverGrid ←
flutter: MediaQuery ← SliverPadding ← Viewport ← ⋯
flutter: parentData: <none> (can use size)
flutter: constraints: BoxConstraints(w=177.5, h=177.5)
flutter: size: Size(177.5, 177.5)
flutter: direction: vertical
flutter: mainAxisAlignment: start
flutter: mainAxisSize: max
flutter: crossAxisAlignment: center
flutter: verticalDirection: down
flutter: ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: A RenderFlex overflowed by 5.9 pixels on the bottom.
flutter: Another exception was thrown: A RenderFlex overflowed by 5.9 pixels on the bottom.
flutter: Another exception was thrown: A RenderFlex overflowed by 5.9 pixels on the bottom.
flutter: Another exception was thrown: A RenderFlex overflowed by 5.9 pixels on the bottom.
有什么想法吗?
答案 0 :(得分:0)
那时任何视图/小部件重叠时,就会发生此问题。为减少此问题,您已将小部件放入堆栈或滚动视图中。
像这样
new Padding(
padding: const EdgeInsets.only(left: 18.0, right: 18.0),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Center(
child: Column(
children: <Widget>[
view1,
view2,
view3,
view4,
],
),
),
),
)
尝试此操作或在此处共享您的代码,以获取有关您的问题的更多信息。