0
点赞
收藏
分享

微信扫一扫

flutter文本和小图标在同一行显示

码农K 2021-10-09 阅读 135
Flutter

Text.rich中使用WidgetSpan来处理图片
效果如下:

代码如下:

Text.rich(
              TextSpan(
                style: TextStyle(fontSize: R.size_32, fontWeight: FontWeight.bold),
                children: [
                  TextSpan(
                    text: '乐讯>每日转发 赚',
                  ),
                  WidgetSpan(
                    child: Image.asset('images/base/money_red_icon.png'),
                  ),
                  TextSpan(
                    text: ' 标志的资讯,赚取佣金~',
                  ),
                ],
              ),
            ),
举报

相关推荐

0 条评论