我有一个 TextSpan 列表,我已将其初始化为一个空列表,然后如果满足某个条件,我会将 TextSpan 添加到其中。
List<TextSpan> _textSpan = [];
if(text.contains("*")){
_textSpan.add(TextSpan( text: text), style: TextStyle(fontWeight: FontWeight.w400))
} else if (){
.
.
.
}
后来我回来:
AutoSizeText.rich(
TextSpan(
children: _textSpan,
Style: TextStyle(),
))
我的问题是如何创建一个可以包装的children: _textSpan函数children: funct(_textSpan)
我努力了:
function(List<TextSpan> StextSpan){
...
}