gpt4 book ai didi

dart - 如何格式化要在 Flutter 中显示的文本

转载 作者:IT王子 更新时间:2023-10-29 06:48:09 24 4
gpt4 key购买 nike

我想在屏幕上显示以下文本,并正确显示上标。如何在 flutter 中做到这一点?

enter image description here

最佳答案

您可以使用 RichTextUnicode

  final defaultStyle = TextStyle(color: Colors.black);
final blueStyle = TextStyle(color: Colors.blue);


return Center(
child: RichText(
text: TextSpan(
text: "c. 10\u{207B}\u{2076} seconds: ",
style: defaultStyle,
children: [
TextSpan(text: "Hadron epoch ", style: blueStyle, children: [
TextSpan(
style: defaultStyle,
text:
"begins: As the universe cools to about 10\u{00B9}\u{2070} kelvin,",
),
])
]),
),
);

更多信息:https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts

关于dart - 如何格式化要在 Flutter 中显示的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53853176/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com