Flutter 2048颤振游戏中android和ios之间的滚动差异
我试着玩这个2048颤振游戏。android的一切都很好,但在iOS上,当我上下滑动来移动区块时,移动的是屏幕。。。所以它是无法播放的 这是源代码 我认为iOS上的垂直手势有问题:Flutter 2048颤振游戏中android和ios之间的滚动差异,flutter,Flutter,我试着玩这个2048颤振游戏。android的一切都很好,但在iOS上,当我上下滑动来移动区块时,移动的是屏幕。。。所以它是无法播放的 这是源代码 我认为iOS上的垂直手势有问题: Container( height: height, child: Stack( children: <Widget>[ Padding(
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),
),
容器(
高度:高度,,
子:堆栈(
儿童:[
填充物(
填充:所有边缘设置(10.0),
儿童:手势检测器(
子项:GridView.count(
主要:错误,
交叉轴间距:10.0,
主轴间距:10.0,
交叉轴计数:4,
子项:getGrid(gridWidth、gridHeight),
),
垂直排水量:(排水量详情){
//初级速度-ve向上+ve向下
如果(详细信息。初始速度<0){
手感(0);
}否则如果(details.primaryVelocity>0){
手感(1);
}
},
onHorizontalDragEnd:(详细信息){
//-ve右,+ve左
如果(details.primaryVelocity>0){
手感(2);
}否则如果(details.primaryVelocity<0){
手感(3);
}
},
),
),
isgameOver
?容器(
高度:高度,,
颜色:颜色(MyColor.transparentWhite),
儿童:中心(
子:文本(
“游戏结束了!”,
样式:TextStyle(
字体大小:30.0,
fontWeight:fontWeight.bold,
颜色:颜色(MyColor.gridBackground)),
),
),
)
:SizedBox(),
伊斯加梅原
?容器(
高度:高度,,
颜色:颜色(MyColor.transparentWhite),
儿童:中心(
子:文本(
“你赢了!”,
样式:TextStyle(
字体大小:30.0,
fontWeight:fontWeight.bold,
颜色:颜色(MyColor.gridBackground)),
),
),
)
:SizedBox(),
],
),
颜色:颜色(MyColor.gridBackground),
),
将其添加到您的
GridView
构造函数中:
GridView.count(
物理学:NeverscrollableScroll物理学(),
// ...
)