RotatedBox Widget – Flutter Widget Guide By Flutter Agency

· 3 min read
RoatedBox-widget
RoatedBox-widget

What is RotatedBox Widget in Flutter?

RotatedBox Widget in Flutter rotated image, text, button other widgets. quarter turns is used to the rotated position.

RotatedBox Widget will only as much as required space by the rotated child.

The constructor of RotatedBox will look like below :

 RoatedBox({
    Key key,
    @required int quarterTurns,
    Widget child,
  });

In the above Constructor, the quarter turns argument must not be null.

Properties:

  • Key key: The widget key, used to control if it’s should be replaced.
  • int quarterTurns: The number of clockwise quarter turns the child should be rotated.
  • Widget Child: The widget below this widget in the tree. Child Property will have only one child. To allocate multiple users needs to make use of Row Widget or Column Widget and wrap the child in it.

Code Snippet for it will look like below :

RotatedBox(
        quarterTurns: 3,
        child:// To do
)

How to use RotatedBox Widget in Flutter?

The following code snippet tells us how to implement RotatedBox  in Flutter.

import 'package:flutter/material.dart';

class RoatedBoxWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: RotatedBox(
        quarterTurns: 3,
        child: Text(
          'RoatedBox Example ',
          style: TextStyle(
            fontSize: 55,
            fontWeight: FontWeight.bold,
            letterSpacing: 0,
          ),
        ),
      ),
    );
  }
}

We will get Output like below:

roated-Box

RotatedBox

Conclusion:

In this article, we have been through What is RotatedBox Widget in Flutter along with how to implement it in a Flutter.

Thanks for reading !!!

Do let us know your feedback/suggestion to serve you better.

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Leave a Reply