Repository navigation
obscureText and enableInteractiveSelection defaults - #24527
Conversation
|
@HansMuller Ready for review whenever you get a chance. I added docs and tests. |
| /// {@macro flutter.widgets.editableText.enableInteractiveSelection} | ||
| final bool enableInteractiveSelection; | ||
|
|
||
| /// Whether or not this field allows text selection. |
There was a problem hiding this comment.
This isn't quite right, since it's about interactive text selection; you can still programmatically change the selection with the controller.
Sadly, I think it will be necessary to exhaustively explain what this getter means vis. enableInteractiveSelection and obscureText.
Similarly, enabledInteractiveSelection will need to explain its (new) default value, etc.
|
@HansMuller I improved the documentation with your comment. I'm a little bit worried about the relationship between TextField's |
76b6021 to
bff78e4
Compare
…fault, delegate to selectionEnabled
| /// Defaults to false, resulting in a typical blinking cursor. | ||
| static bool debugDeterministicCursor = false; | ||
|
|
||
| /// {@macro flutter.widgets.editable.selectionEnabled} |
There was a problem hiding this comment.
Did I set up this macro correctly?
There was a problem hiding this comment.
Yes. The template appears in RenderEditable, so the macro tag should be flutter.rendering.editable.selectionEnabled.
|
@HansMuller Updated according to the refactor we talked about. |
| markNeedsSemanticsUpdate(); | ||
| } | ||
|
|
||
| /// {@template flutter.widgets.editable.selectionEnabled} |
There was a problem hiding this comment.
The template tag should match the class directory, so flutter.rendering.editable.selectionEnabled.
| } | ||
|
|
||
| /// {@template flutter.widgets.editable.selectionEnabled} | ||
| /// Decides if selection is enabled based on [enableInteractiveSelection] and |
There was a problem hiding this comment.
True if interactive selection is enabled based on the values of [enableInteractiveSelection] and [obscureText].
Hopefully the next section will make it clear that the common case is simple.
| /// [obscureText] to make the common use case of password fields simple while | ||
| /// still allowing selection of obscured text. | ||
| /// | ||
| /// Just setting [obscureText] to true will create a typical Material password |
There was a problem hiding this comment.
Don't refer to Material here, RenderEditable and EditableText are used elsewhere. The simplest way to define this method's value might be to do the case analysis:
- By default [enableInteractiveSelection] is null, obscureText is false, and this method returns true.
- If [enableInteractiveSelection] is null, obscureText is true, then this method returns false. This is the common case for password fields.
- If [enableInteractiveSelection] is non-null then its value is returned. An app might set it to true to enable interactive selection for a password field, or to false to unconditionally disable interactive selection.
| /// Defaults to false, resulting in a typical blinking cursor. | ||
| static bool debugDeterministicCursor = false; | ||
|
|
||
| /// {@macro flutter.widgets.editable.selectionEnabled} |
There was a problem hiding this comment.
Yes. The template appears in RenderEditable, so the macro tag should be flutter.rendering.editable.selectionEnabled.
| /// If false, most of the accessibility support for selecting text, copy | ||
| /// and paste, and moving the caret will be disabled. | ||
| /// {@endtemplate} | ||
| /// {@macro flutter.widgets.editableText.enableInteractiveSelection} |
There was a problem hiding this comment.
The @template definition of this macro should appear in rendering/editable.dart.
At the moment it does appear to be defined anywhere.
1d18347 to
dadf737
Compare
dadf737 to
c33e0f1
Compare
|
@HansMuller Updated to address your comments. Let me know if I got everything. |
|
Ready to merge after code freeze. |
…#25342) * Revert "Add imports section to sample code templates, and more docs. (#25184)" This reverts commit 95b0124. * Revert "Use stderr instead of stdout to contain errors in flutter attach test (#25305)" This reverts commit 2b819dd. * Revert "Allow detection of taps on TabBar (#23919)" This reverts commit 01694ab. * Revert "a549981da Roll src/third_party/skia a69b10312977..5eb29448dfbd (1 commits) (flutter-team-archive/engine#7211) (#25333)" This reverts commit a37099f. * Revert "Revert "obscureText and enableInteractiveSelection defaults (#24527)" (#25335)" This reverts commit c545706. * Password fields are no longer selectable nor copiable
Closes #24100