I tried to play with this 2048 flutter game. All is good with android but on iOS when I slide up or down to move blocs it's the screen who move... so it's unplayable

here is the source code https://github.com/anuranBarman/2048

and the part that I think there are a problem with vertical gesture on iOS:

  Container(
              height: height,
              child: Stack(
                children: <Widget>[
                  Padding(
                    padding: EdgeInsets.all(10.0),
                    child: GestureDetector(
                      child: GridView.count(
                        primary: false,
                        crossAxisSpacing: 10.0,
                        mainAxisSpacing: 10.0,
                        crossAxisCount: 4,
                        children: getGrid(gridWidth, gridHeight),
                      ),
                      onVerticalDragEnd: (DragEndDetails details) {
                        //primaryVelocity -ve up +ve down
                        if (details.primaryVelocity < 0) {
                          handleGesture(0);
                        } else if (details.primaryVelocity > 0) {
                          handleGesture(1);
                        }
                      },
                      onHorizontalDragEnd: (details) {
                        //-ve right, +ve left
                        if (details.primaryVelocity > 0) {
                          handleGesture(2);
                        } else if (details.primaryVelocity < 0) {
                          handleGesture(3);
                        }
                      },
                    ),
                  ),
                  isgameOver
                      ? Container(
                          height: height,
                          color: Color(MyColor.transparentWhite),
                          child: Center(
                            child: Text(
                              'Game over!',
                              style: TextStyle(
                                  fontSize: 30.0,
                                  fontWeight: FontWeight.bold,
                                  color: Color(MyColor.gridBackground)),
                            ),
                          ),
                        )
                      : SizedBox(),
                  isgameWon
                      ? Container(
                          height: height,
                          color: Color(MyColor.transparentWhite),
                          child: Center(
                            child: Text(
                              'You Won!',
                              style: TextStyle(
                                  fontSize: 30.0,
                                  fontWeight: FontWeight.bold,
                                  color: Color(MyColor.gridBackground)),
                            ),
                          ),
                        )
                      : SizedBox(),    
                ],
              ),
              color: Color(MyColor.gridBackground),
            ),

enter image description here


Solution 1: Shayne Kelly II

Add this to your GridView constructor:

GridView.count(
    physics: NeverScrollableScrollPhysics(),
    // ...
)