MongolRenderEditable constructor
MongolRenderEditable({
- TextSpan? text,
- MongolTextAlign textAlign = MongolTextAlign.top,
- Color? cursorColor,
- ValueNotifier<
bool> ? showCursor, - bool? hasFocus,
- required LayerLink startHandleLayerLink,
- required LayerLink endHandleLayerLink,
- int? maxLines = 1,
- int? minLines,
- bool expands = false,
- Color? selectionColor,
- double textScaleFactor = 1.0,
- TextSelection? selection,
- required ViewportOffset offset,
- bool ignorePointer = false,
- bool readOnly = false,
- bool forceLine = true,
- String obscuringCharacter = '•',
- bool obscureText = false,
- double? cursorWidth,
- double cursorHeight = 1.0,
- Radius? cursorRadius,
- Offset cursorOffset = Offset.zero,
- double devicePixelRatio = 1.0,
- bool? enableInteractiveSelection,
- Clip clipBehavior = Clip.hardEdge,
- required TextSelectionDelegate textSelectionDelegate,
- MongolRenderEditablePainter? painter,
- MongolRenderEditablePainter? foregroundPainter,
Creates a render object that implements the visual aspects of a text field.
The textAlign
argument must not be null. It defaults to
MongolTextAlign.top.
If showCursor
is not specified, then it defaults to hiding the cursor.
The maxLines
property can be set to null to remove the restriction on
the number of lines. By default, it is 1, meaning this is a single-line
text field. If it is not null, it must be greater than zero.
The offset
is required and must not be null. You can use
ViewportOffset.zero if you have no need for scrolling.
Implementation
MongolRenderEditable({
TextSpan? text,
MongolTextAlign textAlign = MongolTextAlign.top,
Color? cursorColor,
ValueNotifier<bool>? showCursor,
bool? hasFocus,
required LayerLink startHandleLayerLink,
required LayerLink endHandleLayerLink,
int? maxLines = 1,
int? minLines,
bool expands = false,
Color? selectionColor,
double textScaleFactor = 1.0,
TextSelection? selection,
required ViewportOffset offset,
this.ignorePointer = false,
bool readOnly = false,
bool forceLine = true,
String obscuringCharacter = '•',
bool obscureText = false,
double? cursorWidth,
double cursorHeight = 1.0,
Radius? cursorRadius,
Offset cursorOffset = Offset.zero,
double devicePixelRatio = 1.0,
bool? enableInteractiveSelection,
Clip clipBehavior = Clip.hardEdge,
required this.textSelectionDelegate,
MongolRenderEditablePainter? painter,
MongolRenderEditablePainter? foregroundPainter,
}) : assert(maxLines == null || maxLines > 0),
assert(minLines == null || minLines > 0),
assert(
(maxLines == null) || (minLines == null) || (maxLines >= minLines),
"minLines can't be greater than maxLines",
),
assert(
!expands || (maxLines == null && minLines == null),
'minLines and maxLines must be null when expands is true.',
),
assert(obscuringCharacter.characters.length == 1),
assert(cursorWidth == null || cursorWidth >= 0.0),
assert(cursorHeight >= 0.0),
_textPainter = MongolTextPainter(
text: text,
textAlign: textAlign,
textScaleFactor: textScaleFactor,
maxLines: maxLines == 1 ? 1 : null,
),
_showCursor = showCursor ?? ValueNotifier<bool>(false),
_maxLines = maxLines,
_minLines = minLines,
_expands = expands,
_selection = selection,
_offset = offset,
_cursorWidth = cursorWidth,
_cursorHeight = cursorHeight,
_enableInteractiveSelection = enableInteractiveSelection,
_devicePixelRatio = devicePixelRatio,
_startHandleLayerLink = startHandleLayerLink,
_endHandleLayerLink = endHandleLayerLink,
_obscuringCharacter = obscuringCharacter,
_obscureText = obscureText,
_readOnly = readOnly,
_forceLine = forceLine,
_clipBehavior = clipBehavior {
assert(!_showCursor.value || cursorColor != null);
this.hasFocus = hasFocus ?? false;
_selectionPainter.highlightColor = selectionColor;
_selectionPainter.highlightedRange = selection;
_caretPainter.caretColor = cursorColor;
_caretPainter.cursorRadius = cursorRadius;
_caretPainter.cursorOffset = cursorOffset;
_updateForegroundPainter(foregroundPainter);
_updatePainter(painter);
}