hcbpassos / drag_select_grid_view

A grid that supports both dragging and tapping to select its items.
BSD 2-Clause "Simplified" License
133 stars 34 forks source link

Inkwell and Gesturedetector is not working under the grid view #25

Closed gbbest15 closed 3 years ago

gbbest15 commented 3 years ago

i am trying to perform inkwell or Gesturedetector but not working...... let me give a sample code.

i want to perform the one i comment

Expanded(
                    child: DragSelectGridView(
                        shrinkWrap: false,
                        scrollController: scrollcontrol,
                        triggerSelectionOnTap: true,
                        gridController: controller,
                        itemCount: interestIn.length,
                        gridDelegate:
                            new SliverGridDelegateWithFixedCrossAxisCount(
                                crossAxisCount: 3, childAspectRatio: 0.9),
                        itemBuilder:
                            (BuildContext context, int index, isSelected) {
                          return Stack(
                            children: [
                              Padding(
                                padding: const EdgeInsets.all(4.0),
                                child: InkWell(
                                  onTap: () {
                                    // if (isSelected ||
                                    //     stateList
                                    //         .contains(interestIn[index].name)) {
                                    //   stateList.remove(interestIn[index].name);
                                    //   setState(() {});
                                    // }
                                  },
                                  child: Container(
                                    decoration: BoxDecoration(
                                      borderRadius: BorderRadius.only(
                                        topRight: Radius.circular(40),
                                        bottomLeft: Radius.circular(40),
                                      ),
                                      image: DecorationImage(
                                        image:
                                            AssetImage(interestIn[index].url),
                                        fit: BoxFit.fill,
                                        colorFilter: ColorFilter.mode(
                                            Colors.red, BlendMode.darken),
                                      ),
                                    ),
                                    height: 140,
                                    width: 200,
                                    child: Padding(
                                      padding: const EdgeInsets.only(
                                          left: 25.0, bottom: 10),
                                      child: Center(
                                        child: Align(
                                          alignment: Alignment.bottomLeft,
                                          child: Text(
                                            interestIn[index].name,
                                            style: TextStyle(
                                              fontSize: 20,
                                              color: Colors.white,
                                              fontWeight: FontWeight.w500,
                                            ),
                                          ),
                                        ),
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              isSelected ||
                                      stateList.contains(interestIn[index].name)
                                  ? Positioned(
                                      height: 60,
                                      left: 90,
                                      child: Container(
                                        height: 30,
                                        width: 30,
                                        decoration: BoxDecoration(
                                          shape: BoxShape.circle,
                                          color: Colors.white,
                                        ),
                                        child: Center(
                                          child: Icon(
                                            Icons.check_outlined,
                                            size: 18,
                                            color: Colors.red,
                                          ),
                                        ),
                                      ),
                                    )
                                  : Container()
                            ],
                          );
                        }),
                  )