Skip to content

Normalize lerped BoxConstraints with overshooting t values - #190971

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
victorsanni:box-constraints-normalize-lerp
Aug 14, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:masterfrom
victorsanni:box-constraints-normalize-lerp

Conversation

@victorsanni

Copy link
Copy Markdown
Contributor

BoxConstraints.lerp has the signature

static BoxConstraints? lerp(BoxConstraints? a, BoxConstraints? b, double t)

Overshooting curves, such as Curves.easeOutBack, extrapolate t outside of the range 0.0 to 1.0. Without normalizing, the results can be invalid, causing crashes.

This PR normalizes the returned BoxConstraints.

Fixes AnimatedContainer throws Exception when animating height with easeOutBack curve.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 12, 2026
@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Aug 12, 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 updates BoxConstraints.lerp to normalize the resulting constraints, ensuring that overshooting interpolation values do not produce negative or contradictory constraints. It also adds corresponding regression tests. The feedback suggests asserting the exact expected BoxConstraints values in the tests rather than just checking isNormalized to prevent silent regressions.

@victorsanni
victorsanni requested a review from justinmc August 14, 2026 21:08

@justinmc justinmc 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.

LGTM 👍 . Good call. Going negative etc. might make sense for some other values but not for BoxConstraints.

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 14, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 14, 2026
Merged via the queue into flutter:master with commit aa2f375 Aug 14, 2026
21 of 22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

AnimatedContainer throws Exception when animating height with easeOutBack curve.

2 participants