在Text.rich
中使用WidgetSpan
来处理图片与文字
效果如下:
代码如下:
Container(
margin: const EdgeInsets.symmetric(horizontal: 14),
child: Text.rich(
TextSpan(
style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
children: [
WidgetSpan(
child: Image.asset('images/ic_personTip.png',width: 13,height: 13,),
),
const TextSpan(
text: ' 提示:非单身状态在个人头像展示非单身不征婚标识,不能打开遇见并且不能参与相亲',
),
],
),
),
),