Flutter GridTile can be triggered with tap?

前端 未结 2 1173
死守一世寂寞
死守一世寂寞 2021-02-04 05:45

I have created a flutter app and used the image-picker to get images to the center as a gridView with looping the image array with grid tiles.Is it possible to trigger the gridT

2条回答
  •  借酒劲吻你
    2021-02-04 05:53

    You can also work with grid builder

    child: new GridView.builder(
              itemCount: 20,
              gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
                  crossAxisCount: 2),
              itemBuilder: (BuildContext context, int index) {
                return new Card(
                  child: new InkResponse(
                     child: Image.asset('assets/whats-best-for-your-app-objective-cswift.jpg'),
                    onTap: (){
                      print(index);
                    },
                  ),
                );
              }),
    

提交回复
热议问题