如何删除GridView子级之间的空间?

时间:2019-01-30 02:08:05

标签: gridview dart flutter

我正在使用GridView实现标签选择视图,但是无法删除GridView之间的空间,该如何解决?

mainAxisSpacing和crossAxisSpacing不能为负数,所以我不知道该如何处理。...

class _TagScreenState extends State<TagScreen> {


  @override
  Widget build(BuildContext context) {

    final TagBloc _tagBloc = TagBloc();

    return Scaffold(
      body: Column(
        children: <Widget>[
          Container(
            padding: const EdgeInsets.only(top: 40.0,left: 50.0,right: 50.0),
            child: Text(
              '관심있는 태그 5개만 선택해주세요!',
              style: TextStyle(
                color: signUpBackgroundColor,
                fontWeight: FontWeight.bold,
                fontSize: 18.0
              ),
            ),
          ),
          BlocBuilder(
            bloc: _tagBloc,
            builder: (context, TagState state){
              return GridView.builder(
                shrinkWrap: true,
                itemCount: tags.length,
                gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                  crossAxisCount: 3,
                ),
                scrollDirection: Axis.vertical,
                itemBuilder: (BuildContext context, int index){
                  return Stack(
                    children: <Widget>[
                      Image(image: tags[index].image,colorBlendMode: BlendMode.color,),
                      // Container(
                      //   color: Colors.red.withOpacity(0.1),
                      // ),
                    ],
                  );
                }
              );
            },
          )
        ]
      )
    );
  }
}

enter image description here

0 个答案:

没有答案