Flutter 颤振:如何创建带有链接和可点击图标的文本小部件
我如何在颤振中创建下面的图片。我尝试使用Richtext和widget span(可点击图标),但widget span出现错误。。有没有其他方法可以在没有widgetspan的情况下使用不同的布局来执行此操作 这是我的密码Flutter 颤振:如何创建带有链接和可点击图标的文本小部件,flutter,Flutter,我如何在颤振中创建下面的图片。我尝试使用Richtext和widget span(可点击图标),但widget span出现错误。。有没有其他方法可以在没有widgetspan的情况下使用不同的布局来执行此操作 这是我的密码 Expanded( child: RichText( text: new TextSpan( children: [ TextSpan(
Expanded(
child: RichText(
text: new TextSpan(
children: [
TextSpan(
text:
'Email me career-related updates and job opportunities. company ',
style: TextStyle(
color: Palette.DARK_BLUE, fontSize: 16.0),
),
TextSpan(
text: 'privacy policy',
style: TextStyle(
color: Palette.DARK_BLUE,
fontSize: 16.0,
decoration: TextDecoration.underline),
recognizer: TapGestureRecognizer()
..onTap = () {
launch('https://www.google.com');
},
),
TextSpan(
text: ' and ',
style: TextStyle(
color: Palette.DARK_BLUE, fontSize: 16.0),
),
TextSpan(
text: 'terms of use ',
style: TextStyle(
color: Palette.DARK_BLUE,
fontSize: 16.0,
decoration: TextDecoration.underline),
recognizer: TapGestureRecognizer()
..onTap = () {
launch('https://www.google.com/');
},
),
WidgetSpan(
child: Container(
child: Icon(
Icons.info_outline,
color: Colors.red,
),
),
)
],
),
),
),
我刚刚尝试了你的代码,它运行得非常好。我得到的唯一错误是由于
扩展的
小部件。删除扩展的小部件后,我没有收到任何错误。@aligator,谢谢。。当我向上或向下滚动时。,。我得到错误“RangeError(index):无效值:有效值范围为空:0”。如果我删除了“WidgetSpan”,那么错误就会消失。我再试了一次,没有发现这个或任何其他错误。我只是尝试了你的代码,它工作得很好。我得到的唯一错误是由于扩展的
小部件。删除扩展的小部件后,我没有收到任何错误。@aligator,谢谢。。当我向上或向下滚动时。,。我得到错误“RangeError(index):无效值:有效值范围为空:0”。如果我删除了“WidgetSpan”,那么错误就会消失。我再试了一次,没有发现这个或任何其他错误。