How to show square on any digit in flutter UI like above example?
CodePudding user response:
Just use the Unicode character \u00b2
which is superscript 2.
'18.5 kg/m\u00b2 - 25 kg/m\u00b2'
CodePudding user response:
No native way to do this I think.But you can refer latex-related package like
CodePudding user response:
you can reach the superscript letters like this with FontFeatures
:
Text(
'The isotope 238U decays to 206Pb',
style: TextStyle(
fontFamily: 'Sorts Mill Goudy',
fontFeatures: <FontFeature>[
FontFeature.superscripts(),
],
),
),
in this case, we used the superscripts()
which will show the letters as a superscript.
read about it more in the official docs