AnyText.fromRichText constructor

AnyText.fromRichText(
  1. RichText widget
)

Factory constructor to create an AnyText instance from a RichText widget.

This constructor is used to create an AnyText widget from a RichText widget. It extracts and consolidates various text-related properties from the RichText for use in AnyText.

Implementation

factory AnyText.fromRichText(RichText widget) {
  return AnyText._(
    widget: widget,
    textStyle: widget.text.style,
    maxLines: widget.maxLines,
    //minLines: https://github.com/flutter/flutter/issues/31134,
    text: widget.text.toPlainText(),
    overflow: widget.overflow,
    softWrap: widget.softWrap,
    textDirection: widget.textDirection,
    textAlign: widget.textAlign,
    locale: widget.locale,
    selectionColor: widget.selectionColor,
  );
}