How to get coordinates, scale, and rotation data of a widget in flutter?

1.2k views Asked by At

I am working an app in flutter in which user can add image on a video like the given screenshot. The user should be able to move the image widget anywhere on the screen, resize it, and rotate it also.

For now I have used Stack and MatrixGestureDetector to let the user move the images on the screen.

From the user placed image I would like to acquire:

  • position/coordinates
  • scale
  • rotation

This data will then be used in ffmpeg, but this question is only about getting the placement data.

Example of image and draw text in canvas over a video:

As you can see, we can move image and draw text in canvas over a video. After doing all this, how to get exact positions about where to merge the images

1

There are 1 answers

1
imcouri On

there are two ways that you can do this, there is a hard way and there's an easy way:

  • easy way:
    you can use packages like tapioca to add text overlay to your videos

  • hard way : you basically split the video into single image frames and add a text overlay every single frame using a stack widget, which is not easy to implement.