flutter text upper and lower corner mark display, such as angle, temperature

 In the project, when the text is displayed, there will be subscript characters. Flutter has built-in constants for these characters. For example, "superscript 1" is, " $sup1superscript 2" is $sup2, and so on. It also includes greek characters and many other things.

1. Introduce charcode in pubspec.yaml

charcode: ^1.3.1

2. Import character set library

//根据需要导入
import 'package:charcode/ascii.dart' as Ascii;
import 'package:charcode/html_entity.dart' as HtmlEntity;

 3. Text Text and rich text RichText use subscript characters

//度数 °
String deg = String.fromCharCode(HtmlEntity.$deg);
Container(
  alignment: Alignment.center,
  height: 60.px,
  child: Text("今天温度:27 ${deg}C"),
),

Guess you like

Origin blog.csdn.net/lqw200931116/article/details/123392806