Row 或者 Colunm,与ListView 、ListTile等组件搭配错误,直接在Row 或者Colunm的子组件中使用Expand组件即可
这是正确的,不报错的
return Container( child: Row( children: <Widget>[ Expanded( child: ListTile( title: Text(titleName,style: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize: 16.0),), subtitle: Text(subTitle), ), ) ], ), );
这是错误的,
return Container( child: Row( children: <Widget>[ ListTile( title: Text(titleName,style: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize: 16.0),), subtitle: Text(subTitle), ), ], ), );