Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to invert a text in Flutter?

Tags:

flutter

dart

Can anyone post a simple example of inverting a Text placed inside a Container.

Here is the starting code.

Widget _myWidget() {
  return Container(
    height: 100.0,
    color: Colors.orange,
    child: Center(child: Text("GO", style: TextStyle(fontSize: 70.0)),),
  );
}

Above code shows following output:

enter image description here

What I want it to look like is :

enter image description here


1 Answers

This is the code to do that

    import 'dart:math';
    class FlipedText extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Material(
        child: Transform(
          transform:Matrix4.rotationX(pi),
          alignment: Alignment.center,

          child: Container(
            height: 100.0,
            color: Colors.orange,
            child: Center(child: Text("GO", style: TextStyle(fontSize: 70.0)),),
          ),
        ),
      );
    }
  }
like image 65
Saed Nabil Avatar answered Sep 10 '25 00:09

Saed Nabil