Skip to content

Fix TextStyle background color fade-out when lerping to null - #196153

Merged
LongCatIsLooong merged 3 commits into
flutter:masterfrom
hangy233:fix/text-style-background-color-lerp-master
Nov 17, 2026
Merged

LongCatIsLooong merged 3 commits into
flutter:masterfrom
hangy233:fix/text-style-background-color-lerp-master

Conversation

@hangy233

@hangy233 hangy233 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #196151

Description

TextStyle.lerp(redStyle, null, t) should fade a text background out as t increases. In the b == null branch, backgroundColor instead calls Color.lerp(null, a.backgroundColor, t), fading it in. This change reverses those endpoints, consistent with the adjacent color and decorationColor fields, and adds a regression test.

Minimal reproduction

The issue's runnable sample displays three text rows with a red background style interpolated toward null at t = 0, 0.5, and 1. Before this fix, the rows go from transparent to opaque red; they should go from opaque red to transparent.

const redStyle = TextStyle(backgroundColor: Colors.red);
Column(
  children: [
    for (final t in [0.0, 0.5, 1.0])
      Text('t = $t', style: TextStyle.lerp(redStyle, null, t)),
  ],
);

Tests

  • flutter test packages/flutter/test/painting/text_style_test.dart — 20 passed.
  • flutter test --no-pub --fatal-warnings test/painting/ from packages/flutter — 665 passed, 11 skipped.
  • dev/customer_testing/ci.bat — 16 public customer tests passed.
  • flutter analyze --no-pub on both changed files — no issues.
  • dart format --output=none --set-exit-if-changed on both changed files — no changes.

The remaining upstream CI and private contributed tests will run after the PR opens. This does not change a public API or require a client-code migration, so no Data Driven Fix is applicable.

Pre-launch Checklist

@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 Nov 7, 2026

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

Copy link
Copy Markdown
Contributor

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 modifies TextStyle.lerp to correctly interpolate backgroundColor when the target style is null, changing the lerp parameters so that the background color fades out from the source color to null. It also adds a unit test to verify this transition. I have no feedback to provide.

@Renzo-Olivares
Renzo-Olivares force-pushed the fix/text-style-background-color-lerp-master branch from b4faea0 to ebf5fb3 Compare November 12, 2026 21:37
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 12, 2026
@Renzo-Olivares Renzo-Olivares added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Nov 12, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 12, 2026
@auto-submit

auto-submit Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

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

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 13, 2026
@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2026
@hangy233

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews! Tree_analyze was cancelled before analysis ran, and the PR now says it’s awaiting the CICD label. Could someone restart CI?

@LongCatIsLooong LongCatIsLooong added the CICD Run CI/CD label Nov 13, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2026
@auto-submit

auto-submit Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196153, Failed to enqueue flutter/flutter/196153 with HTTP 400: Pull request Required status check "Check Code Freeze" is expected..

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 13, 2026
@LongCatIsLooong LongCatIsLooong added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Nov 13, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2026
@auto-submit

This comment was marked as outdated.

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit

auto-submit Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196153, Failed to enqueue flutter/flutter/196153 with HTTP 400: Pull request Required status check "Check Code Freeze" is expected..

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit

auto-submit Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196153, Failed to enqueue flutter/flutter/196153 with HTTP 400: Pull request Required status check "Check Code Freeze" is in progress..

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit

This comment was marked as outdated.

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2026
@auto-submit

auto-submit Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196153, Failed to enqueue flutter/flutter/196153 with HTTP 400: Pull request Required status check "Check Code Freeze" is expected..

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2026
@auto-submit

auto-submit Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196153, Failed to enqueue flutter/flutter/196153 with HTTP 400: Pull request Required status check "Check Code Freeze" is expected..

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2026
@auto-submit

auto-submit Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196153, Failed to enqueue flutter/flutter/196153 with HTTP 400: Pull request Required status check "Check Code Freeze" is expected..

@LongCatIsLooong

Copy link
Copy Markdown
Contributor

I think there's an issue with some of the github actions: #196551, but I couldn't get autosubmit to work even with the workaround. I'm going to try manually merging this.

@LongCatIsLooong
LongCatIsLooong added this pull request to the merge queue Nov 17, 2026
Merged via the queue into flutter:master with commit e83635a Nov 17, 2026
52 checks passed
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 17, 2026
flutter/flutter@d8bd864...2f09f96

2026-11-17 [email protected] Analyze every flutter create template, and fix the package_ffi lint (flutter/flutter#196165)
2026-11-17 [email protected] Roll Dart SDK from 50debf3c9757 to 26e38955d9d4 (3 revisions) (flutter/flutter#196772)
2026-11-17 [email protected] Manual roll ICU from b09986242cfb to d3c612f44146 (1 revision) (flutter/flutter#196713)
2026-11-17 [email protected] Roll Skia from 4f6b3a8d8565 to 503a380ebecc (19 revisions) (flutter/flutter#196768)
2026-11-17 [email protected] iOS: Don't mock UIView animations in keyboard spring animation test (flutter/flutter#196755)
2026-11-17 [email protected] [flutter_tools] Preserve index.html across --web-content-hash transitions (flutter/flutter#196491)
2026-11-17 [email protected] Fix TextStyle background color fade-out when lerping to null (flutter/flutter#196153)
2026-11-17 [email protected] Update desktop engine TESTOWNERS (flutter/flutter#196732)
2026-11-17 [email protected] [flutter_tools] Do not copy app-only build type properties onto library plugins (flutter/flutter#196692)
2026-11-17 [email protected] [flutter_tools] Remove service and runner ambient context getters (flutter/flutter#196571)
2026-11-17 [email protected] Bump customer tests (flutter/flutter#196740)
2026-11-17 [email protected] Take customer_testing_flame out of bringup (flutter/flutter#196570)
2026-11-17 [email protected] [devicelab] Read AssetManifest.bin from the APK in flavors_test (flutter/flutter#196736)
2026-11-17 [email protected] [flutter_tools] Fix flaky tool_tests_general by moving spawnUri tests to integration shard (flutter/flutter#195999)
2026-11-17 [email protected] Roll Dart SDK from 3e069c6fdbde to 50debf3c9757 (2 revisions) (flutter/flutter#196706)
2026-11-16 [email protected] [web] Record build finish synchronously in renderScene and fix dropped frame timings (flutter/flutter#195947)
2026-11-16 [email protected] Do not reveal obscured character when input is rejected by inputFormatters (flutter/flutter#195022)
2026-11-16 [email protected] Cla draft follow up: add waiting for response (flutter/flutter#196686)
2026-11-16 [email protected] Roll pub packages (flutter/flutter#196684)
2026-11-16 [email protected] Roll Packages from 015df97 to 4c6a7d3 (8 revisions) (flutter/flutter#196681)
2026-11-16 [email protected] Skip Vulkan impeller_unittests on macOS (flutter/flutter#196282)
2026-11-16 [email protected] Move the task runners out of Flutter Engine (flutter/flutter#196267)
2026-11-16 [email protected] [FGP] Add Flutter assets after AGP's asset merge so dotfiles are pack… (flutter/flutter#196465)
2026-11-16 [email protected] iOS: Add Obj-C model for platform view composition params (flutter/flutter#196498)
2026-11-16 [email protected] [Windows] Normalize Shift key messages with a non-standard scan code (flutter/flutter#193675)
2026-11-16 [email protected] Roll Skia from 118eaff3deb4 to 4f6b3a8d8565 (3 revisions) (flutter/flutter#196672)
2026-11-16 [email protected] Roll Dart SDK from c91e8b6674e2 to 3e069c6fdbde (4 revisions) (flutter/flutter#196669)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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 CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextStyle.lerp fades backgroundColor in when interpolating to null

3 participants