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

码农K

关注

阅读 135

2021-10-09

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)

0 0 举报