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

Skip to content

Conversation

@ahmedsameha1
Copy link
Contributor

This is my attempt to handle #6537 for the DecoratedBox widget.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Dec 27, 2025
Copy link
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 adds a regression test for an issue where DecoratedBox crashes when it has a zero size and a gradient. While the test case is a good addition, its current implementation with an empty BoxDecoration does not trigger the crash condition. I've provided a suggestion to include a gradient in the decoration to ensure the test correctly covers the scenario from issue #6537. The fix for the underlying crash itself appears to be missing from this PR.

const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox.shrink(child: DecoratedBox(decoration: BoxDecoration())),
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current test setup with an empty BoxDecoration() doesn't trigger the crash condition reported in issue #6537. The crash occurs when a gradient is present on a zero-sized DecoratedBox. To properly test for this scenario, you should add a gradient to the BoxDecoration.

          child: SizedBox.shrink(child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(begin: Alignment.topLeft, end: Alignment.bottomRight, colors: <Color>[Color(0xFF000000), Color(0xFFFFFFFF)])))),

@justinmc justinmc requested a review from victorsanni December 30, 2025 23:20
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.

LGTM 👍

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 31, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Dec 31, 2025
Merged via the queue into flutter:master with commit 6954931 Dec 31, 2025
71 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants