flutter中富文本 图文排列
flutter 文本 图文 排列
2023-09-27 14:28:53 时间
使用WidgetSpan能够存放不是TextSpan格式的Widget
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 1,
child: Text.rich(
TextSpan(
children:[
WidgetSpan(
child: Icon(Icons.add, color: Colors.deepOrangeAccent, size: ScreenAdapter.size(35),),
),
TextSpan(
text:'很骄傲实打实的就卡机按计划奥术杀了肯德基拉就开始弹尽粮绝大师大',
style: TextStyle(
fontSize: ScreenAdapter.size(30)
),
)
]
)
),
)
],
),
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 RichText 富文本标签样式 局部文字点击事件
- Flutter TextField 边框样式以及提示文本 、Flutter输入文本TextField
- flutter RotationTransition实现旋转动画
- 创建交互式用户界面:Flutter 中可关闭小部件的实用指南
- 探索最新版本 Flutter 中令人兴奋的新功能
- Flutter在iOS上的表现就是一坨屎
- Flutter教程大全合集(2022年版)
- Flutter iOS风格文本输入框CupertinoTextField光标在Android中未与提示文本对齐
- 2022年为什么要使用Flutter构建应用程序?
- flutter 版本控制fvm
- 修改 Flutter 中字体的大小和颜色