Thanks to visit codestin.com
Credit goes to github.com

Skip to content

InputDecorator - animate between transparent hoverColor and hoverColor #168244

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
May 3, 2025

Conversation

nsparks
Copy link
Contributor

@nsparks nsparks commented May 2, 2025

As described in #155169, TextFields with hoverColor set can have an issue where they flicker as the mouse enters and exits their bounds.

_BorderContainerState uses a 15ms animation to transition between non-hovered and hovered states. Part of this animation is a ColorTween between Colors.transparent and a given hoverColor. Critically, Colors.transparent is transparent black. On high refresh rate displays (any display with faster than 60z), this can result in a frame being rendered where the TextField fill color is a dark, semi-transparent version of hoverColor.

The immediate solution to this is to animate between hoverColor and a hoverColor with alpha 0.

Before: https://github.com/user-attachments/assets/01d62c6a-015d-4dc7-9897-7c3a75ca8aa0
After: https://github.com/user-attachments/assets/ff51a5b2-ba4a-4508-a111-4c915d31ac46

Fixes #155169

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 2, 2025
@nsparks nsparks marked this pull request as ready for review May 2, 2025 20:55
Copy link
Member

@jtmcdole jtmcdole left a comment

Choose a reason for hiding this comment

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

printer2

@jtmcdole jtmcdole added the autosubmit Merge PR when tree becomes green via auto submit App label May 2, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 2, 2025
Copy link
Contributor

auto-submit bot commented May 2, 2025

autosubmit label was removed for flutter/flutter/168244, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

Copy link
Contributor

auto-submit bot commented May 2, 2025

autosubmit label was removed for flutter/flutter/168244, because - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jtmcdole
Copy link
Member

jtmcdole commented May 2, 2025

Push an empty commit and you'll be good to go. The CI system (right now) already has the previous bd82a963c20b4060e131de9bdb66945c4d620b6f recorded

@nsparks
Copy link
Contributor Author

nsparks commented May 2, 2025

Push an empty commit and you'll be good to go. The CI system (right now) already has the previous bd82a963c20b4060e131de9bdb66945c4d620b6f recorded

Done!

@jtmcdole jtmcdole added the autosubmit Merge PR when tree becomes green via auto submit App label May 2, 2025
Copy link
Contributor

auto-submit bot commented May 2, 2025

autosubmit label was removed for flutter/flutter/168244, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 2, 2025
@jtmcdole jtmcdole requested review from reidbaker and justinmc May 2, 2025 21:20
@jtmcdole
Copy link
Member

jtmcdole commented May 2, 2025

@reidbaker @justinmc - this is a reland (to master) for #168166

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

RSLGTM 👍

@jtmcdole jtmcdole added the autosubmit Merge PR when tree becomes green via auto submit App label May 2, 2025
@auto-submit auto-submit bot added this pull request to the merge queue May 2, 2025
Merged via the queue into flutter:master with commit bc0d328 May 3, 2025
75 of 76 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
ash2moon pushed a commit to ash2moon/flutter that referenced this pull request May 5, 2025
flutter#168244)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

As described in flutter#155169,
TextFields with hoverColor set can have an issue where they flicker as
the mouse enters and exits their bounds.

_BorderContainerState uses a 15ms animation to transition between
non-hovered and hovered states. Part of this animation is a ColorTween
between Colors.transparent and a given hoverColor. Critically,
Colors.transparent is transparent black. On high refresh rate displays
(any display with faster than 60z), this can result in a frame being
rendered where the TextField fill color is a dark, semi-transparent
version of hoverColor.

The immediate solution to this is to animate between hoverColor and a
hoverColor with alpha 0.

Before:
https://github.com/user-attachments/assets/01d62c6a-015d-4dc7-9897-7c3a75ca8aa0
After:
https://github.com/user-attachments/assets/ff51a5b2-ba4a-4508-a111-4c915d31ac46

Fixes flutter#155169
## Pre-launch Checklist

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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Nick Sparks <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request May 6, 2025
flutter#168244)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

As described in flutter#155169,
TextFields with hoverColor set can have an issue where they flicker as
the mouse enters and exits their bounds.

_BorderContainerState uses a 15ms animation to transition between
non-hovered and hovered states. Part of this animation is a ColorTween
between Colors.transparent and a given hoverColor. Critically,
Colors.transparent is transparent black. On high refresh rate displays
(any display with faster than 60z), this can result in a frame being
rendered where the TextField fill color is a dark, semi-transparent
version of hoverColor.

The immediate solution to this is to animate between hoverColor and a
hoverColor with alpha 0.

Before:
https://github.com/user-attachments/assets/01d62c6a-015d-4dc7-9897-7c3a75ca8aa0
After:
https://github.com/user-attachments/assets/ff51a5b2-ba4a-4508-a111-4c915d31ac46

Fixes flutter#155169
## Pre-launch Checklist

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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Nick Sparks <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

TextField blinks when hoverColor == filledColor on displays with refresh rates higher than 60Hz
4 participants