InteractiveViewer (for zoomin &zoomout)

edited December 2022 in Flutter

with InteractiveViewer widget we can zoomin & zoom out the images or layouts.

example:

TransformationController controller = TransformationController();


InteractiveViewer(
                    child: Image.asset(tiger),
                    transformationController: controller,
                    boundaryMargin: EdgeInsets.all(5.0),
                    onInteractionEnd: (ScaleEndDetails endDetails) {
                      print(endDetails);
                      print(endDetails.velocity);
                      controller.value = Matrix4.identity();
                      setState(() {
                        velocity = endDetails.velocity.toString();

                      });
                      },
                  ),

with the help of controller we can control the zoom functionality

Sign In or Register to comment.