Trying to crop the video of a video to display a preview as a square without changing its width and height.
How to make a square video 1:1 without losing its aspect ration in Flutter with video_player package
Asked
Active
Viewed 235 times
1 Answers
1
This is how it makes a square video
Container(
width: 200, //Crop width
height: 200, //Crop height
child: FittedBox(
// alignment: Alignment.center, //Move around the crop
fit: BoxFit.cover,
clipBehavior: Clip.hardEdge,
child: SizedBox(
width: videoController.value.size.width,
height: videoController.value.size.height,
child: AspectRatio(
aspectRatio: videoController.value.aspectRatio,
child: VideoPlayer(
videoController,
),
),
),
),
);

J. Diaz
- 371
- 1
- 6
- 16
-
You can use the "AspectRatio" widget and use "aspectRatio: 1" and doesn't matter the size of the screen, it will always be square. – Mariano Zorrilla Oct 11 '22 at 13:13