Skip to content

Conversation

@HansMuller
Copy link
Contributor

Fixes #27626

Restored the Material textfield tests that were changed in #24876.

Cleaned up the platform-specific configuration code in _TextFieldState.build().

@zoechi zoechi added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Feb 8, 2019
TextSelectionControls textSelectionControls;
bool paintCursorAboveText;
bool cursorOpacityAnimates;
Offset cursorOffset;
Copy link
Member

Choose a reason for hiding this comment

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

Do we not need the default value of 2 coming from the widget.cursorOffset?

Some random yak shaving while we're here. I had to click through all the editables to realize that RenderEditable handles nulls. Can we add it to the doc?

Copy link
Member

Choose a reason for hiding this comment

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

I also thing I'm leaning towards liking the getters more. It takes less effort to read and realize that we're only dealing with an Android and an iOS value and don't have to follow the local variable through to watch out for the fallthrough/null case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cursorOffset is only defined for iOS.

I moved the couple of getters that were returning platform-specific values to the block of code that handles configuring the EditableText's other platform-specific values because it's easier to read (all in one place), simpler, and that's the way the rest of it already was.

I'll be happy to add some documentation about null parameters to RenderEditable in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

oops, sorry, there is no widget.cursorOffset. I misread widget.cursorWidth

expect(textField.cursorRadius, const Radius.circular(3.0));
});

// TODO(hansmuller): restore these tests after the fix for #24876 has landed.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what this comment means. Isn't this PR the fix for the fix for #24876?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I was going to land the fix and then update the golden images and then update this test.

@xster
Copy link
Member

xster commented Feb 8, 2019

LGTM

@xster
Copy link
Member

xster commented Feb 8, 2019

cc @jslavitz

@HansMuller HansMuller merged commit 944ede8 into flutter:master Feb 8, 2019
@HansMuller HansMuller deleted the textfield_cursor branch February 8, 2019 22:31
kangwang1988 pushed a commit to XianyuTech/flutter that referenced this pull request Feb 12, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Material TextField's cursor seems off

4 participants