|
|
|
|
|
|
"minLines and maxLines must be null when expands is true." |
|
|
|
); |
|
|
|
D.assert(!obscureText || maxLines == 1, () => "Obscured fields cannot be multiline."); |
|
|
|
|
|
|
|
scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f); |
|
|
|
D.assert(scrollPadding != null); |
|
|
|
toolbarOptions = toolbarOptions ?? new ToolbarOptions( |
|
|
|
copy: true, |
|
|
|
|
|
|
inputFormatters.Add(formatter); |
|
|
|
} |
|
|
|
} |
|
|
|
showCursor = showCursor ?? !readOnly; |
|
|
|
|
|
|
|
this.showCursor = !readOnly; |
|
|
|
this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f); |
|
|
|
this.scrollPadding = scrollPadding; |
|
|
|
this.controller = controller; |
|
|
|
this.focusNode = focusNode; |
|
|
|
this.obscureText = obscureText; |
|
|
|
|
|
|
this.smartQuotesType = smartQuotesType.Value; |
|
|
|
this.showCursor = showCursor; |
|
|
|
this.showCursor = showCursor.Value; |
|
|
|
this.textWidthBasis = textWidthBasis; |
|
|
|
this.onSelectionHandleTapped = onSelectionHandleTapped; |
|
|
|
this.scrollController = scrollController; |
|
|
|
|
|
|
public readonly TextWidthBasis textWidthBasis; |
|
|
|
public readonly VoidCallback onSelectionHandleTapped; |
|
|
|
public readonly ScrollController scrollController; |
|
|
|
public readonly bool? showCursor; |
|
|
|
public readonly bool showCursor; |
|
|
|
public readonly ui.BoxHeightStyle selectionHeightStyle; |
|
|
|
public readonly ui.BoxWidthStyle selectionWidthStyle; |
|
|
|
public readonly bool forceLine; |
|
|
|
|
|
|
_cursorBlinkOpacityController.addListener(_onCursorColorTick); |
|
|
|
_floatingCursorResetController = new AnimationController(vsync: this); |
|
|
|
_floatingCursorResetController.addListener(_onFloatingCursorResetTick); |
|
|
|
_cursorVisibilityNotifier.value = widget.showCursor ?? false; |
|
|
|
_cursorVisibilityNotifier.value = widget.showCursor; |
|
|
|
} |
|
|
|
|
|
|
|
public override void didChangeDependencies() { |
|
|
|
|
|
|
if (widget.controller.selection != oldWidget.controller.selection) { |
|
|
|
_selectionOverlay?.update(_value); |
|
|
|
} |
|
|
|
_selectionOverlay.handlesVisible = widget.showSelectionHandles; |
|
|
|
|
|
|
|
if (_selectionOverlay != null) { |
|
|
|
_selectionOverlay.handlesVisible = widget.showSelectionHandles; |
|
|
|
} |
|
|
|
|
|
|
|
if (widget.focusNode != oldWidget.focusNode) { |
|
|
|
oldWidget.focusNode.removeListener(_handleFocusChanged); |
|
|
|
_focusAttachment?.detach(); |
|
|
|
|
|
|
fontFamily: style.fontFamily, |
|
|
|
fontSize: style.fontSize, |
|
|
|
fontWeight: style.fontWeight, |
|
|
|
textDirection: (TextDirection)_textDirection, |
|
|
|
textDirection: _textDirection.Value, |
|
|
|
textAlign: widget.textAlign |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
void _onCursorColorTick() { |
|
|
|
renderEditable.cursorColor = |
|
|
|
widget.cursorColor.withOpacity(_cursorBlinkOpacityController.value); |
|
|
|
_cursorVisibilityNotifier.value = widget.showCursor.Value && _cursorBlinkOpacityController.value > 0; |
|
|
|
_cursorVisibilityNotifier.value = widget.showCursor && _cursorBlinkOpacityController.value > 0; |
|
|
|
} |
|
|
|
|
|
|
|
public bool cursorCurrentlyVisible { |
|
|
|
|
|
|
cursorColor: _cursorColor, |
|
|
|
backgroundCursorColor: widget.backgroundCursorColor, |
|
|
|
showCursor: EditableText.debugDeterministicCursor |
|
|
|
? new ValueNotifier<bool>(widget.showCursor ?? false) |
|
|
|
? new ValueNotifier<bool>(widget.showCursor) |
|
|
|
: _cursorVisibilityNotifier, |
|
|
|
forceLine: widget.forceLine, |
|
|
|
readOnly: widget.readOnly, |
|
|
|