美文网首页Flutter 学习
flutter中富文本的实现

flutter中富文本的实现

作者: 月未雪 | 来源:发表于2019-11-04 16:07 被阅读0次

flutter中富文本的实现

  1.RichText
  2.TextSpan
  3.WidgetSpan        (实现富文本中的背景自定义)

  例如:

               RichText(
                            text: TextSpan(
                                  text: "登录代表同意",
                                  style: TextStyle(
                                      color: Styles.rgb_color_666,
                                      fontSize: Styles.textsize_13),
                                  children: [
                                    TextSpan(
                                        text: "《***用户协议》",
                                        style: TextStyle(
                                          color: Styles.rgb_color_FFF36E22,
                                          fontSize: Styles.textsize_13,
                                        ),
                                        recognizer: TapGestureRecognizer()
                                          ..onTap = () {}),
                                    TextSpan(
                                        text: "和 ",
                                        style: TextStyle(
                                            color: Styles.rgb_color_666,
                                            fontSize: Styles.textsize_13)),
                                    TextSpan(
                                        text: "《隐私政策》",
                                        style: TextStyle(
                                            color: Styles.rgb_color_FFF36E22,
                                            fontSize: Styles.textsize_13),
                                        recognizer: TapGestureRecognizer()
                                          ..onTap = () {}),
                                  ]),
                            )

相关文章

网友评论

    本文标题:flutter中富文本的实现

    本文链接:https://www.haomeiwen.com/subject/mfydbctx.html