AnyText.fromEditableText constructor

AnyText.fromEditableText(
  1. EditableTextState state
)

Factory constructor to create an AnyText instance from an EditableText.

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

Implementation

factory AnyText.fromEditableText(EditableTextState state) {
  final widget = state.widget;
  final InlineSpan text = state.renderEditable.text!;
  return AnyText._(
    widget: widget,
    textStyle: text.style,
    maxLines: widget.maxLines,
    minLines: widget.minLines,
    text: widget.controller.text,
    //overflow: https://github.com/flutter/flutter/issues/80434,
    //softWrap: https://github.com/flutter/flutter/issues/53166,
    textDirection: widget.textDirection,
    textAlign: widget.textAlign,
    locale: widget.locale,
    selectionColor: widget.selectionColor,
  );
}