首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AppBar中的字幕

AppBar中的字幕
EN

Stack Overflow用户
提问于 2018-07-22 16:27:23
回答 1查看 1.3K关注 0票数 0

我有一个标题和副标题如下的SliverAppBar:

代码语言:javascript
复制
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]),)
                  ]),

它会运行,但如果我滚动,我会收到这个错误:

代码语言:javascript
复制
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.

我必须使用什么来代替列?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2018-07-22 17:20:37

这意味着小部件比视图大。现在,您可以做的是将Column包装在SingleChildScrollView中,让它滚动:

代码语言:javascript
复制
SingleChildScrollView( child: Column(...) )
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51463303

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档