Today we will be discussing usage of RotatedBox in Flutter application. When and Why to use RotatedBox while you are developing an android and iOS application.
If you want to rotate any of the widgets in your application then in that case you would be using the RotatedBox widget to get the work done easily. It applies its rotation prior to layout. And hence it consumes only space required by the rotated child in the widget.
As shown in the picture, suppose you want to rotate the text “Rotation” to 90 degrees then in this case RotatedBox is the best option to use. And it gives a new look to rather more obvious horizontal looks for your application.
RotatedBox affects the layout of your application and hence if it is used then it will take the space of your layout as shown in the figure “Rotation” takes the space of around 25% of the layout vertically.
RotatedBox is not same as Transform Widget
RotatedBox is not equivalent to Transform. As if you want that your layout should not get affected because of your rotation then you should use Transform Widget instead. As Transform widget does not affect the layout. And also, the Transform widget rotates at its place.
You can add any kind of child in the RotatedBox widget. So, the child can be anything in RotatedBox widget usage.
RotatedBox( quarterTurns: 3, child: MyWidget(), )
Read about Stack Flutter Widget as well for more about Flutter Widget.