RotatedBox Widget

What is RotatedBox Widget?

The RotatedBox is to rotate its child widget.

Default Constructor

The default constructor creates a widget that rotates its child.

RotatedBox(
    quarterTurns: // required argument
    child:
)

Constructor Parameters

It contains many input parameters which can be configured to change its behavior and appearance.

The quarterTurns parameter is to add the number of clockwise quarter turns the child should be rotated. The quarterTurns argument is required and must not be null.

The child parameter is to add the widget below the Opacity widget in a tree.

Code snippet

This code snippet shows how to configure RotatedBox widget.

RotatedBox(
        quarterTurns: 3,
        child: const Text('Hello World!'),
)

Demo Code

This example shows how to rotate the child Text widget with three quarter turns so that its renders from bottom to top.

import 'package:flutter/material.dart';

class RotatedBoxDemo extends StatelessWidget {
  
  Widget build(BuildContext context) {
    return Material(
        child: Center(
      child: RotatedBox(
        quarterTurns: 3,
        child: const Text('Hello World!'),
      ),
    ));
  }
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('RotatedBox Demo')),
        body: RotatedBoxDemo(),
      ),
    );
  }
}

void main() => runApp(MyApp());