builder static method

Widget builder({
  1. required String text,
  2. List<HighlightWord> highlights = const [],
  3. TextStyle? defaultTextStyle,
  4. TextStyle? defaultHighlightStyle,
  5. int maxLines = 5,
  6. TextOverflow overflow = TextOverflow.ellipsis,
})

Implementation

static Widget builder({
  required String text,//全部文本内容
  List<HighlightWord> highlights = const [],//高亮数据集合
  TextStyle? defaultTextStyle,//默认文本样式
  TextStyle? defaultHighlightStyle,//高亮文本样式
  int maxLines = 5,//最大行数
  TextOverflow overflow = TextOverflow.ellipsis,//文本超出样式
}) {
  var spans = _buildTextSpans(text, highlights, defaultTextStyle, defaultHighlightStyle);
  return RichText(
    maxLines: maxLines,
    overflow: overflow,
    text: TextSpan(children: spans),
  );
}