【发布时间】:2021-10-22 05:51:30
【问题描述】:
我有这两个包,我想使用flutter_linkify 和readmore。 linkify 将文本中的 url 和电子邮件转换为可点击的链接,而 readmore 将长文本切割成较短的文本,我想将它们与相同的文本一起使用
String randomText = "DetectableTextField is published as a refinement of this isaackelechi2000@gmail.com package. hashtagale forces you to use hashtag, but this one allows you to detect anything you want. If you also want https://www.google.com to decorate At sign, you can do that by adding the argument decorateAtSign: true. "
//Using linkify
Linkify(
onOpen: (link) => print("Clicked ${link.url}!"),
text: randomText,
);
//using readmore
ReadMoreText(
randomText,
trimLines: 2,
colorClickableText: Colors.pink,
trimMode: TrimMode.Line,
trimCollapsedText: 'Show more',
trimExpandedText: 'Show less',
moreStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
);
那么我怎样才能在同一屏幕上不显示两个不同的文本的情况下使用这两个具有相同文本的包
【问题讨论】:
标签: flutter dart text flutter-packages