Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Flip An Image in flutter

enter image description here

i am capturing an image by camera and want to flip that image as i show in sample picture of Giraffe.

like image 954
Arslan Ehsan Avatar asked Oct 13 '25 04:10

Arslan Ehsan


2 Answers

Use Transform and give the image as child,

 Transform(
    alignment: Alignment.center,
    transform: Matrix4.rotationY(math.pi),
    child: Image.network('https://i.sstatic.net/VroJR.png'),
  )

enter image description here

like image 98
blackkara Avatar answered Oct 14 '25 18:10

blackkara


With Flutter 3.10.2 and above versions (Don't know about the previous versions have this), you can flip as below:

Transform.flip(
 flipX: true, // Flip horizontally
 flipY: true, // Flip vertically
 child: Your widget,
)
like image 43
Rajni Gujarati Avatar answered Oct 14 '25 19:10

Rajni Gujarati