RText constructor

RText({
  1. Key? key,
  2. required List<String> texts,
  3. TextStyle? style,
  4. List<TextStyle?> styles = const [],
  5. List<GestureRecognizer?> recognizers = const [],
  6. List<String?> semanticsLabels = const [],
  7. List<MouseCursor?> mouseCursors = const [],
  8. List<PointerEnterEventListener?> onEnters = const [],
  9. List<PointerExitEventListener?> onExits = const [],
  10. List<Locale?> locales = const [],
  11. List<bool?> spellOuts = const [],
  12. StrutStyle? strutStyle,
  13. TextAlign textAlign = TextAlign.center,
  14. TextDirection? textDirection,
  15. Locale? locale,
  16. bool softWrap = true,
  17. TextOverflow overflow = TextOverflow.clip,
  18. double textScaleFactor = 1.0,
  19. int? maxLines,
  20. TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  21. TextHeightBehavior? textHeightBehavior,
  22. SelectionRegistrar? selectionRegistrar,
  23. Color? selectionColor,
})

Implementation

RText({
  super.key,

  /// 文本
  required List<String> texts,

  /// 所有[texts]默认样式
  TextStyle? style,

  /// [texts]内样式
  List<TextStyle?> styles = const [],

  /// [texts]内手势
  List<GestureRecognizer?> recognizers = const [],

  /// [texts]内语义 - 语义描述标签,相当于此text的别名
  List<String?> semanticsLabels = const [],

  /// 新增属性
  List<MouseCursor?> mouseCursors = const [],
  List<PointerEnterEventListener?> onEnters = const [],
  List<PointerExitEventListener?> onExits = const [],
  List<Locale?> locales = const [],
  List<bool?> spellOuts = const [],

  /// StrutStyle,影响Text在垂直方向上的布局
  super.strutStyle,

  /// TextAlign,内容对齐方式
  super.textAlign = TextAlign.center,

  /// TextDirection,内容的走向方式
  super.textDirection,

  /// Locale,当相同的Unicode字符可以根据不同的地区以不同的方式呈现时,用于选择字体
  super.locale,

  /// bool 文本是否应在软换行时断行
  super.softWrap = true,

  /// TextOverflow,内容溢出时的处理方式
  super.overflow = TextOverflow.clip,

  /// double 设置文字的放大缩小,例如,fontSize=10,this.textScaleFactor=2.0,最终得到的文字大小为10*2.0
  super.textScaleFactor = 1.0,

  /// int 设置文字的最大展示行数
  super.maxLines,

  /// TextWidthBasis 测量一行或多行文本宽度
  super.textWidthBasis = TextWidthBasis.parent,
  super.textHeightBehavior,
  super.selectionRegistrar,
  super.selectionColor,
})  : assert(texts.isNotEmpty),
      super(
          text: buildTextSpan(buildTextSpans(
              texts: texts,
              style: style,
              styles: styles,
              semanticsLabels: semanticsLabels,
              recognizers: recognizers,
              mouseCursors: mouseCursors,
              onEnters: onEnters,
              onExits: onExits,
              locales: locales,
              spellOuts: spellOuts)));