1

Does anybody knows how to make (in a easy way) upper index in text field?

My code:

Row(
   mainAxisAlignment: MainAxisAlignment.center,
   crossAxisAlignment: CrossAxisAlignment.baseline,
   textBaseline: TextBaseline.alphabetic,
       children: [
          Text(
             widget.weather.temp.round().toString(),
             style: TextStyle(
                 color: Colors.white,
                 fontSize: 150,
               ),
          Text(
             '°C',
             style: TextStyle(
                fontSize: 50.0,
             ),
          )
       ],
),

This code gives me bottom aligmnet (index)

Bottom index example

and how to make upper index like this:

Upper index example

  • 1
    Check this answer: https://stackoverflow.com/questions/54254516/how-can-we-use-superscript-and-subscript-text-in-flutter-text-or-richtext – Georgina Sep 30 '22 at 13:54

1 Answers1

2

Try this text

Text("${widget.weather.temp.round().toString()}\u00b0\u1d9c")