Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 6, 2018

Conversation

sandrasandeep
Copy link
Contributor

Addresses issue #14656. Adds static field to EditableText to enable developers to make the cursor continually appear on the screen (for testing purposes).

@@ -399,6 +399,15 @@ class EditableText extends StatefulWidget {
/// Defaults to EdgeInserts.all(20.0).
final EdgeInsets scrollPadding;

static bool get debugDeterministicCursor => _debugDeterministicCursor;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a doc comment explaining this setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@@ -399,6 +399,15 @@ class EditableText extends StatefulWidget {
/// Defaults to EdgeInserts.all(20.0).
final EdgeInsets scrollPadding;

static bool get debugDeterministicCursor => _debugDeterministicCursor;
static bool _debugDeterministicCursor = false;
static set debugDeterministicCursor(bool value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this setter doesn't really do anything? Could we just use a regular property here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@gspencergoog
Copy link
Contributor

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@@ -399,6 +399,8 @@ class EditableText extends StatefulWidget {
/// Defaults to EdgeInserts.all(20.0).
final EdgeInsets scrollPadding;

static bool debugDeterministicCursor = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here describing what it does and when it is used (only in tests).

@sandrasandeep sandrasandeep dismissed gspencergoog’s stale review August 6, 2018 17:36

Added documentation as requested.

@gspencergoog
Copy link
Contributor

LGTM (still) :-)

Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -1030,4 +1036,4 @@ class _Editable extends LeafRenderObjectWidget {
..cursorWidth = cursorWidth
..cursorRadius = cursorRadius;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: leave the last newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it out because it causes the tests to fail.

@sandrasandeep sandrasandeep merged commit d041b31 into flutter:master Aug 6, 2018
Hixie added a commit that referenced this pull request Aug 6, 2018
Hixie added a commit that referenced this pull request Aug 6, 2018
* Revert "increase size of user account drawer headers to 48 by 48 (#20266)"

This reverts commit 4a7b4a4.

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

This reverts commit d041b31.

* Revert "Refactor analysis benchmark and collect more data (#20169)"

This reverts commit 5ea0a13.
@@ -881,7 +887,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
textSpan: buildTextSpan(),
value: _value,
cursorColor: widget.cursorColor,
showCursor: _showCursor,
showCursor: EditableText.debugDeterministicCursor ? ValueNotifier<bool>(true) : _showCursor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have a constant here rather than creating a new value notifier each frame

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants