【发布时间】:2020-02-28 06:02:00
【问题描述】:
Screen of the number puzzle game
这是我的代码.. 当点击按钮时,我使用了手势检测器的 ontap() 函数来移动磁贴。我想实现滑动的功能,将磁贴移动到无色部分。
main.dart
Widget tiles(int i) {
bool isZero = i == 0;
return GestureDetector(
onTap: (){
movePosition(i);
},
child: ShakeView(
controller: _shakeController,
child: Container(
width: 125,
height: 100,
margin: EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: isZero ? Colors.white : Color(0xff000080),
border: Border.all(width: 2.0),
),
child: Center(
child: Text(
'$i',
style: TextStyle(color: Colors.white, fontSize: 25),
),
),
),
),
);
}
【问题讨论】:
-
尝试动画容器。
标签: flutter flutter-layout flutter-animation