Flutter MatrixGestureDetector设置为identity

Flutter MatrixGestureDetector设置为identity,flutter,flutter-animation,Flutter,Flutter Animation,我正在使用设置矩阵: ... onMatrixUpdate: (Matrix4 m, Matrix4 tm, Matrix4 sm, Matrix4 rm) { setState(() { matrix = MatrixGestureDetector.compose(m, null, null, null); ... 然后在另一个函数中,我将相同的矩阵设置为: matrix = Matrix4.identity(); 现在,当再次调用Mat

我正在使用设置矩阵:

...
onMatrixUpdate: (Matrix4 m, Matrix4 tm, Matrix4 sm, Matrix4 rm) {
            setState(() {
              matrix = MatrixGestureDetector.compose(m, null, null, null);
...
然后在另一个函数中,我将相同的矩阵设置为:

matrix = Matrix4.identity();
现在,当再次调用MatrixGestureDetector中的onMatrixUpdate时,矩阵与
Matrix4.identity()不匹配。
有没有办法将MatrixGestureDetector设置为identity

多亏了@pskink,我在做
matrix=Matrix4.identity()的同一个函数中尝试了这一点

使用:


是否按照建议工作,我只需要将转换小部件包装在动画生成器中并使用ValueNotifier。

请参见您知道如何设置MatrixGestureDetector的内部矩阵吗?您没有设置内部矩阵,您看到我发布的代码了吗?从Matrix Update上的
开始:(m,tm,sm,rm)
您使用
tm
sm
rm
MatrixGestureDetector。compose
方法工作正常
matrix = MatrixGestureDetector.compose(matrix, translateMatrix, scaleMatrix, null);
matrix = MatrixGestureDetector.compose(matrix, tm, sm, null);