Flutter 颤振:“;RenderFlex子项具有非零的弹性,但传入的高度约束是无界的;

Flutter 颤振:“;RenderFlex子项具有非零的弹性,但传入的高度约束是无界的;,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,当我将FutureBuilder包装到列中时,我希望在另一个小部件中有一个ListView,以便有一个简单的行。我得到这个错误: The following assertion was thrown during performLayout(): I/flutter (13816): RenderFlex children have non-zero flex but incoming height constraints are unbounded. I/flutter (13816): Wh

当我将
FutureBuilder
包装到
列中时,我希望在另一个小部件中有一个
ListView
,以便有一个简单的
行。我得到这个错误:

The following assertion was thrown during performLayout():
I/flutter (13816): RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I/flutter (13816): When a column is in a parent that does not provide a finite height constraint, for example, if it is
I/flutter (13816): in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
I/flutter (13816): flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining
I/flutter (13816): space in the vertical direction.
I/flutter (13816): These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child
I/flutter (13816): cannot simultaneously expand to fit its parent.
I/flutter (13816): Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible
I/flutter (13816): children (using Flexible rather than Expanded). This will allow the flexible children to size
I/flutter (13816): themselves to less than the infinite remaining space they would otherwise be forced to take, and
I/flutter (13816): then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum
I/flutter (13816): constraints provided by the parent.
I/flutter (13816): If this message did not help you determine the problem, consider using debugDumpRenderTree():
Container
  child: Column
         children: Column, Spacer, Row
我的代码:

class ActivityShowTicketReplies扩展StatefulWidget{
最终地图票证数据;
ActivityShowTicketReplies({@required this.ticketData});
@凌驾
State createState()=>ActivityShowTicketRepliesState();
}
类活动ShowTicketRepliesState扩展状态{
TicketsTableData get _ticket=>TicketsTableData.fromJson(json.decode(widget.ticketData.values.toList()[0][0].toString());
@凌驾
小部件构建(构建上下文){
返回范围模型(
模型:CounterModel(),
孩子:方向性(
textDirection:textDirection.rtl,
孩子:脚手架(
正文:专栏(
儿童:[
划船(
mainAxisAlignment:mainAxisAlignment.center,
crossAxisAlignment:crossAxisAlignment.center,
儿童:[
填充物(
填充:常量边集。对称(垂直:20.0),
孩子:升起按钮(
颜色:颜色,靛蓝,
onPressed:()=>BlocProvider.of(context).dispatch(FragmentNavigateEvent(routeName:FRAGMENT\u NEW\u TICKET)),
形状:RoundedRectangleBorder(borderRadius:borderRadius.circular(50.0)),
子:容器(
子:文本(
“新票”,
样式:AppTheme(context.caption().copyWith(颜色:Colors.white),
),
),
),
),
],
),
未来建设者(
future:Provider.of(context.find)(ticketId:_ticket.id),
生成器:(上下文,快照){
if(snapshot.connectionState==connectionState.done){
if(snapshot.hasData){
最终列表ticketReplies=snapshot.data;
if(ticketReplies.isNotEmpty){
返回列(
儿童:[
卡片(
clipBehavior:Clip.antiAlias,
颜色:颜色。灰色[50],
保证金:所有边缘套(10.0),
孩子:InkWell(
子:堆栈(
儿童:[
纵队(
儿童:[
填充物(
填充:常量边集。对称(垂直:12.0),
孩子:ListTile(
标题:填充(
填充:常量边集。对称(垂直:5.0),
子:文本(
“主题”,
样式:AppTheme(context).caption().copyWith(fontFamily:'ShabnamBold'),
),
),
字幕:文本(
_主题,
样式:AppTheme(上下文).caption(),
),
),
),
容器(
身高:30.0,
边距:EdgeInsets.zero,
宽度:double.infinity,
颜色:颜色。灰色[200],
孩子:排(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
],
),
),
],
),
对齐(
对齐:alignment.topLeft,
子:容器(
边距:仅限边缘集(顶部:10.0),
约束:BoxConstraints(
最小宽度:70.0,
),
身高:20.0,
宽度:70.0,
装饰:盒子装饰(
颜色:颜色。绿色[200],
borderRadius:仅限borderRadius(
右上角:半径。圆形(5.0),
右下角:半径。圆形(5.0),
)),
儿童:中心(
子:文本(
"地位",,
样式:AppTheme(context).overLine().copyWith(fontFamily:'shannambold',颜色:Colors.black),
),
)),
),
Card(
    child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
                Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus finibus luctus tortor id pulvinar. Donec sollicitudin, dui vitae aliquam tristique, eros risus commodo enim, eget lobortis arcu velit ac arcu. "),
                Text("Nunc tristique, ex ut volutpat feugiat, nulla nibh iaculis lectus, laoreet auctor justo tellus quis mi. Praesent ut interdum sem. Donec eget finibus augue, et vehicula elit. Praesent eu euismod arcu, eu maximus tellus. Ut diam est, sodales nec enim a, pharetra lobortis erat."),
            ]
     )
)
Container
  child: Column
         children: Column, Spacer, Row
Container
  child: Column
         children: Column, SizedBox(height: 10), Row
Scaffold(
  body: SingleChildScrollView(
    child: SizedBox(
      height: MediaQuery.of(context).size.height,
      child: Column(
        children: [
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: SizedBox(
              height: MediaQuery.of(context).size.height,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[

Screen
  → Column
    → Column
      → Expanded → ERROR
Screen
  ↓ constraint ↓ (Screen)
  Column
    Text_A (fixed height: no constraint needed) → OK
    Column 
      ↓ constraint ↓ (unbounded)
      Text_B (fixed height) → OK
      Expanded: calc. height = unbounded - Text_B → ERROR
  parent size (constraint) - fixed-items size = remaining space
  unbounded - Text_B = unbounded (error)
Screen
  → Column
    → Column
      → Expanded
/// 1. Layout each child with a null or zero flex factor (e.g., those that are not
///    [Expanded]) with unbounded vertical constraints
  unbounded - Text_B = unbounded (error)