我现在要限制行数并在flutter中呈现html标签,现在我正在使用“文本”小部件和
限制行数。问题是我在其余完整的api中获取了html标签,因此我想呈现这些标签。我尝试了flutter html包,但是没有选择限制行数。
谢谢
Container(
padding: EdgeInsets.symmetric(horizontal:10.0),
margin: EdgeInsets.only(bottom:10.0),
child: Text(
widget.description,
style:plpDescriptionTextstyle,
maxLines: 4,
),
),
最佳答案
经过几个小时的搜索,我遇到了这种解决方案,以防万一有人遇到相同的问题。
Container(
padding: EdgeInsets.symmetric(horizontal:2.0),
margin: EdgeInsets.only(bottom:10.0),
child:
Html(
data: widget.description.substring(0, 90)+'..'
),
),
关于flutter - 如何在Flutter中呈现HTML标签并限制行数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62505075/