我正在尝试在gridview.builder中添加一个新的自定义按钮。在我的gridview中,我有5个项目,请参见下图
请查看我的简单代码。
GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3),
itemCount: _categoryList.length,
itemBuilder: (context, index) {
if (_categoryList.length != 0) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
backgroundColor: Colors.transparent,
backgroundImage: NetworkImage(_categoryList[index].icon,),
),
);
} else
return Container();
},
),