📜  Flutter:如何在段落中加粗(或格式化)一段文本? - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:55.799000             🧑  作者: Mango

代码示例1
url: https://stackoverflow.com/questions/41557139/how-do-i-bold-or-format-a-piece-of-text-within-a-paragraph

var text = RichText(
  text: TextSpan(
    // Note: Styles for TextSpans must be explicitly defined.
    // Child text spans will inherit styles from parent
    style:TextStyle(
      fontSize: 14.0,
      color: Colors.black,
    ),
    children: [
       TextSpan(text: 'Hello'),
       TextSpan(text: 'World', style: TextStyle(fontWeight: FontWeight.bold)),
    ],
  ),
 );