Created
February 7, 2020 10:13
-
-
Save deven98/9db883d8483458d76da10ff186293d8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyHomePage extends StatefulWidget { | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
double x = 0; | |
double y = 0; | |
double z = 0; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Transform( | |
transform: Matrix4( | |
1,0,0,0, | |
0,1,0,0, | |
0,0,1,0, | |
0,0,0,1, | |
)..rotateX(x)..rotateY(y)..rotateZ(z), | |
alignment: FractionalOffset.center, | |
child: GestureDetector( | |
onPanUpdate: (details) { | |
setState(() { | |
y = y - details.delta.dx / 100; | |
x = x + details.delta.dy / 100; | |
}); | |
}, | |
child: Container( | |
color: Colors.red, | |
height: 200.0, | |
width: 200.0, | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment