Flutter 错误:The method ‘>‘ was called on null

不说废话,直接上方法:

一般是ListView 搭配 Row 或者 Colunm错误,直接在Row 或者Colunm的子组件中使用Expand组件即可

这是正确的,不报错的

 

return Container(
      child: Row(
        children: [
          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: [
           ListTile(
              title: Text(titleName,style: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize: 16.0),),
              subtitle: Text(subTitle),
            ),
       
        ],
      ),
    );

 

 

你可能感兴趣的:(Flutter学习错误集锦,flutter,method,was,called)