Skip to content

[Animations] Add support for custom shadows to OpenContainer (#62475)#11401

Open
moepanda wants to merge 1 commit intoflutter:mainfrom
moepanda:fix_open_container_shadow
Open

[Animations] Add support for custom shadows to OpenContainer (#62475)#11401
moepanda wants to merge 1 commit intoflutter:mainfrom
moepanda:fix_open_container_shadow

Conversation

@moepanda
Copy link
Copy Markdown

Summary

This PR adds support for custom BoxShadow to the OpenContainer widget. This allows developers to specify closedShadows and openShadows to create more advanced and visually appealing transitions that go beyond the standard material elevation.

  • Fixes a legacy layout overflow issue in _ExampleSingleTile by replacing the fixed height with responsive constraints, ensuring the example remains stable across different system font sizes and shadow distributions.

Motivation

Currently, OpenContainer only supports a numeric elevation property, which limits modern UI designs requiring colored or multi-layered shadows. This PR also refactors the internal rendering hierarchy to move the shadow decoration outside the clipping surface, fixing a legacy issue where custom shadows were clipped by Material.

Issues

Fixes flutter/flutter#62475

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA]. (Reminder: Please ensure you've signed it!)
  • The title of the PR starts with [animations]
  • I linked to at least one issue that this PR fixes in the description above.
  • I followed [the version and CHANGELOG instructions].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.

@github-actions github-actions bot added p: animations triage-framework Should be looked at in framework triage labels Mar 31, 2026
Copy link
Copy Markdown

@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 support for custom closedShadows and openShadows to the OpenContainer widget, enabling custom shadow animations during transitions. It also fixes a layout overflow in the example app by transitioning from a fixed height to minimum height constraints and includes new tests to verify shadow behavior. A review comment suggests conditionally wrapping the Material widget with DecoratedBox only when custom shadows are provided to avoid unnecessary widgets in the tree.

@moepanda moepanda force-pushed the fix_open_container_shadow branch 3 times, most recently from 2f3b47b to 88d57a1 Compare April 1, 2026 05:42
@moepanda moepanda force-pushed the fix_open_container_shadow branch from 88d57a1 to f6d83d3 Compare April 1, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: animations triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenContainer add customize shadow support

1 participant