addText method

RichTextGenerator addText(
  1. String text, {
  2. TextStyle? textStyle,
  3. double? fontSize,
  4. Color? color,
  5. FontWeight? fontWeight,
})

添加自定义文案 text 显示的文案 textStyle 文案的样式 fontWeight 字体的粗细 默认是 normal fontSize 文案大小 默认是16 color 文案的颜色 默认是深黑色

Implementation

RichTextGenerator addText(
  String text, {
  TextStyle? textStyle,
  double? fontSize,
  Color? color,
  FontWeight? fontWeight,
}) {
  _spanList.add(
    TextSpan(
      text: text,
      style: textStyle ??
          TextStyle(
            color: color ??
                BaseThemeConfig.instance
                    .getConfig()
                    .commonConfig
                    .colorTextBase,
            fontSize: fontSize ?? 16,
            fontWeight: fontWeight ?? FontWeight.normal,
          ),
    ),
  );
  return this;
}