Skip to content

Remove Material from Live Text test in editable_text_test#185242

Open
momshaddinury wants to merge 1 commit intoflutter:masterfrom
momshaddinury:cleanup/editable-text-test-import
Open

Remove Material from Live Text test in editable_text_test#185242
momshaddinury wants to merge 1 commit intoflutter:masterfrom
momshaddinury:cleanup/editable-text-test-import

Conversation

@momshaddinury
Copy link
Copy Markdown

The test Tapping the Live Text button calls onLiveTextInput in packages/flutter/test/widgets/editable_text_test.dart was flagged with an in-code TODO:

// TODO(justinmc): Widgets tests should not import Material.
// https://github.com/flutter/flutter/issues/177028

This test lives in the Widgets layer but was using MaterialApp, Typography.material2018(), Colors.blue, Colors.grey, and materialTextSelectionHandleControls — none of which are actually required for what it exercises (the Live Text button inside CupertinoAdaptiveTextSelectionToolbar).

Changes:

  • Replace MaterialApp with TestWidgetsApp (from widgets_app_tester.dart, already imported in this file).
  • Replace Typography.material2018().black.titleMedium! with const TextStyle(fontSize: 14.0).
  • Replace Colors.blue / Colors.grey with raw Color values, matching the pattern already used by the adjacent test in the same file.
  • Replace materialTextSelectionHandleControls with emptyTextSelectionControls.
  • Remove the TODO.

The file-level package:flutter/material.dart import remains because many other tests in this 19k-line file still legitimately depend on it. This PR resolves the one flagged test block.

Related Issues

Part of #177028
Related: #177412

Tests

No behavior change; the same assertions are preserved. Verified locally with:

flutter test --name "Tapping the Live Text button calls onLiveTextInput" packages/flutter/test/widgets/editable_text_test.dart

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@github-actions github-actions 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 Apr 18, 2026
@momshaddinury
Copy link
Copy Markdown
Author

@justinmc I just realized that after submitting a couple of similar pull requests, I probably shouldn't have since the todo had your name on it. I'm trying to make my first contribution and found this task to be the simplest one to tackle. Please feel free to close this if you prefer.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors editable_text_test.dart by replacing MaterialApp with TestWidgetsApp and removing Material-specific dependencies. The review feedback suggests reverting the font size to 16.0 to maintain consistency with the original test configuration and using uppercase hex digits for color literals to comply with style conventions.

Comment thread packages/flutter/test/widgets/editable_text_test.dart Outdated
Comment thread packages/flutter/test/widgets/editable_text_test.dart Outdated
@momshaddinury momshaddinury force-pushed the cleanup/editable-text-test-import branch from 64b915c to 1f7e08a Compare April 18, 2026 09:43
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 framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant