Flutter: How to rotate an Icon?

github logo ・1 min read

Transform widget to the rescue

A Transform widget “transforms” (i.e. changes the shape, size, position and orientation) its child widget before painting it.

Transform.rotate

Transform.rotate rotates a child by an angle in radians not degrees. So, to rotate by 90 degrees, you need to multiply 90 x π/180 to get the value in radians.

Code:

Don't forget to import 'dart:math' to use pi. :) More info on Transform widget here:

twitter logo DISCUSS
Classic DEV Post from Apr 30

Who's looking for open source contributors? (April 30th edition)

Melvin Soldia profile image
DEV.join()

Come for the ideas.
Stay for the community.