Unverified Commit d041b319 authored by sandrasandeep's avatar sandrasandeep Committed by GitHub

EditableText Cursor can be set to not blink for testing (#20004)

* no blinking cursor

* debugDeterministicCursor: private -> public

* added documentation

* whitespace
parent 5ea0a135
...@@ -399,6 +399,12 @@ class EditableText extends StatefulWidget { ...@@ -399,6 +399,12 @@ class EditableText extends StatefulWidget {
/// Defaults to EdgeInserts.all(20.0). /// Defaults to EdgeInserts.all(20.0).
final EdgeInsets scrollPadding; final EdgeInsets scrollPadding;
/// Setting this property to true makes the cursor stop blinking and stay visible on the screen continually.
/// This property is most useful for testing purposes.
///
/// Defaults to false, resulting in a typical blinking cursor.
static bool debugDeterministicCursor = false;
@override @override
EditableTextState createState() => new EditableTextState(); EditableTextState createState() => new EditableTextState();
...@@ -881,7 +887,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien ...@@ -881,7 +887,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
textSpan: buildTextSpan(), textSpan: buildTextSpan(),
value: _value, value: _value,
cursorColor: widget.cursorColor, cursorColor: widget.cursorColor,
showCursor: _showCursor, showCursor: EditableText.debugDeterministicCursor ? ValueNotifier<bool>(true) : _showCursor,
hasFocus: _hasFocus, hasFocus: _hasFocus,
maxLines: widget.maxLines, maxLines: widget.maxLines,
selectionColor: widget.selectionColor, selectionColor: widget.selectionColor,
...@@ -1030,4 +1036,4 @@ class _Editable extends LeafRenderObjectWidget { ...@@ -1030,4 +1036,4 @@ class _Editable extends LeafRenderObjectWidget {
..cursorWidth = cursorWidth ..cursorWidth = cursorWidth
..cursorRadius = cursorRadius; ..cursorRadius = cursorRadius;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment