Kinda Code
Home/Flutter/Flutter Vertical Text Direction: An Example

Flutter Vertical Text Direction: An Example

Last updated: August 24, 2023

In Flutter, you can set the orientation of the text characters in a line to vertical by wrapping a Text widget inside a RotatedBox widget, like this:

RotatedBox(
              quarterTurns: 1,
              child: Text(
                'Just Some Vertical Text',
                style: TextStyle(fontSize: 50),
              ),
            ),

A Complete Example

Screenshot:

The full code:

// main.dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        // Remove the debug banner
        debugShowCheckedModeBanner: false,
        title: 'Kindacode.com',
        theme: ThemeData(
          primarySwatch: Colors.amber,
        ),
        home: const HomePage());
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Kindacode.com'),
      ),
      body: const Padding(
        padding: EdgeInsets.all(30),
        child: Row(
          children: [
            RotatedBox(
              quarterTurns: 1,
              child: Text(
                'Just Some Vertical Text',
                style: TextStyle(fontSize: 50),
              ),
            ),
            SizedBox(
              width: 30,
            ),
            RotatedBox(
              quarterTurns: 3,
              child: Text(
                'Just Some Vertical Text',
                style: TextStyle(fontSize: 50),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Continue learning Flutter:

You can also check out our Flutter category page, or Dart category page for the latest tutorials and examples.