Aditya Patil
Aditya Patil

Reputation: 1486

How to show square on digit in flutter

enter image description here

How to show square on any digit in flutter UI like above example?

Upvotes: 1

Views: 1456

Answers (4)

Yogesh Kumawat
Yogesh Kumawat

Reputation: 61

You can use these unicodes or you can search others on internet:

  print('Degrees: 25\u00b0C');
  print('Multiplication: 5\u00d75');
  print('Division: 10\u00f72');
  print('Infinity: \u221e');
  print('Pi: \u03c0');
  print('Square Root: \u221a9');
  print('Heart: \u2764');
  print('Check Mark: \u2713 Success');
  print('18.5 kg/m\u00b2 - 25 kg/m\u00b2');
    // Mathematical symbols
  print('Less than or equal: x \u2264 5');
  print('Summation: \u2211n');
  
  // Arrows
  print('Arrow: \u2192 Forward');
  
  // Greek Letters
  print('Gamma: \u03b3');
  
  // Currencies
  print('Price: \u20b9 1000');
  
  // Shapes and Icons
  print('Shapes: \u25a0 \u25cf \u2605');
  
  // Emoji-like symbols
  print('\u263a Smile! \u2600 Sun \u262e Peace');
}

Upvotes: 0

Roslan Amir
Roslan Amir

Reputation: 1336

Just use the Unicode character \u00b2 which is superscript 2.

'18.5 kg/m\u00b2 - 25 kg/m\u00b2'

Upvotes: 6

Gwhyyy
Gwhyyy

Reputation: 9166

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(),
    ],
  ),
),

enter image description here

in this case, we used the superscripts() which will show the letters as a superscript.

read about it more in the official docs

Upvotes: 0

zionpi
zionpi

Reputation: 2671

No native way to do this I think.But you can refer latex-related package like flutter_tex to implement this.
A screenshot from its demo video: show square digit

Upvotes: 2

Related Questions