Skip to content

Conversation

@Renzo-Olivares
Copy link
Contributor

@Renzo-Olivares Renzo-Olivares commented Oct 13, 2022

This change makes TextEditingDelta mixin Diagnosticable and adds overrides for debugFillProperties for TextEditingDeltaInsertion, TextEditingDeltaDeletion, TextEditingDeltaReplacement, and TextEditingDeltaNonTextUpdate.

Fixes #113394

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Oct 13, 2022
@LongCatIsLooong
Copy link
Contributor

But in case you want to better incorporate this into widgets consider using DianosticsNode

Comment on lines 75 to 83
expect(
const TextEditingDeltaInsertion(
oldText: 'hello worl',
textInserted: 'd',
insertionOffset: 10,
selection: TextSelection.collapsed(offset: 11),
composing: TextRange.empty).toString(),
equals('TextEditingDeltaInsertion(oldText: hello worl, textInserted: d, insertionOffset: 10, selection: TextSelection.collapsed(offset: 11, affinity: TextAffinity.downstream, isDirectional: false), composing: TextRange(start: -1, end: -1))')
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just my 2 cents about readability, consider formatting all calls to expect in this way:

    expect(
      const TextEditingDeltaInsertion(
        oldText: 'hello worl',
        textInserted: 'd',
        insertionOffset: 10,
        selection: TextSelection.collapsed(offset: 11),
        composing: TextRange.empty,
      ).toString(),
      equals(
        'TextEditingDeltaInsertion(oldText: hello worl, textInserted: d, insertionOffset: 10, selection: TextSelection.collapsed(offset: 11, affinity: TextAffinity.downstream, isDirectional: false), composing: TextRange(start: -1, end: -1))',
      ),
    );

@Renzo-Olivares Renzo-Olivares changed the title Add toString definition for concrete TextEditingDelta implementations Make TextEditingDelta diagnosticable and override debugFillProperties for concrete TextEditingDelta implementations Oct 14, 2022
@Renzo-Olivares Renzo-Olivares added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 14, 2022
@auto-submit auto-submit bot merged commit 300181b into flutter:master Oct 17, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Oct 17, 2022
…operties for concrete TextEditingDelta implementations (flutter/flutter#113395)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Oct 17, 2022
…operties for concrete TextEditingDelta implementations (flutter/flutter#113395)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 19, 2022
…operties for concrete TextEditingDelta implementations (flutter/flutter#113395)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextEditingDelta implementations should define toString

3 participants