Flutter: How to move, rotate and zoom the container?

前端 未结 3 509
栀梦
栀梦 2020-12-12 05:23

I want to make a container which can be dragged around, zoom and rotate. I am able to achieve a zoom. Below is my code:

//variable declaration
  double _scal         


        
3条回答
  •  情深已故
    2020-12-12 05:35

    use Matrix Gesture Detector package1 package, here you have the basic sample:

    MatrixGestureDetector(
      onMatrixUpdate: (m, tm, sm, rm) {
        setState(() {
          matrix = n;
        });
      },
      child: Transform(
        transform: matrix,
        child: ....
      ),
    ),
    

    for more sample code refer to example folder that contains 6 demos

提交回复
热议问题