我有一个标题和副标题如下的SliverAppBar:
SliverAppBar(
backgroundColor: Colors.white,
forceElevated: true,
elevation: 1.0,
pinned: true,
floating: true,
snap: false,
title: Column(
children: <Widget>[
Container(padding: EdgeInsets.only(top: 6.0, bottom: 5.0),
child: Text('Contest', style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500))),
Text(_getFiltersString(), style: TextStyle(fontSize: 14.0, color: Colors.grey[700]),)
]),它会运行,但如果我滚动,我会收到这个错误:
I/flutter ( 4765): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 4765): The following message was thrown during layout:
I/flutter ( 4765): A RenderFlex overflowed by 30 pixels on the bottom.
I/flutter ( 4765):
I/flutter ( 4765): The overflowing RenderFlex has an orientation of Axis.vertical.
I/flutter ( 4765): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
I/flutter ( 4765): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
I/flutter ( 4765): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
I/flutter ( 4765): RenderFlex to fit within the available space instead of being sized to their natural size.
I/flutter ( 4765): This is considered an error condition because it indicates that there is content that cannot be
I/flutter ( 4765): seen. If the content is legitimately bigger than the available space, consider clipping it with a
I/flutter ( 4765): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
I/flutter ( 4765): like a ListView.
I/flutter ( 4765): The specific RenderFlex in question is:
I/flutter ( 4765): RenderFlex#968e7 relayoutBoundary=up14 OVERFLOWING
I/flutter ( 4765): creator: Column ← Semantics ← DefaultTextStyle ← LayoutId-[<_ToolbarSlot.middle>] ←
I/flutter ( 4765): CustomMultiChildLayout ← NavigationToolbar ← DefaultTextStyle ← IconTheme ← Builder ←
I/flutter ( 4765): CustomSingleChildLayout ← ClipRect ← ConstrainedBox ← ⋯
I/flutter ( 4765): parentData: <none> (can use size)
I/flutter ( 4765): constraints: BoxConstraints(0.0<=w<=176.0, 0.0<=h<=20.3)
I/flutter ( 4765): size: Size(70.0, 20.3)
I/flutter ( 4765): direction: vertical
I/flutter ( 4765): mainAxisAlignment: start
I/flutter ( 4765): mainAxisSize: max
I/flutter ( 4765): crossAxisAlignment: center
I/flutter ( 4765): verticalDirection: down
I/flutter ( 4765): ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
I/flutter ( 4765): ════════════════════════════════════════════════════════════════════════════════════════════════════
Reloaded 32 of 722 libraries in 2.887ms.我必须使用什么来代替列?
谢谢
发布于 2018-07-22 17:20:37
这意味着小部件比视图大。现在,您可以做的是将Column包装在SingleChildScrollView中,让它滚动:
SingleChildScrollView( child: Column(...) )https://stackoverflow.com/questions/51463303
复制相似问题