Skip to content

[animations] Add scrimColor to OpenContainer - #13716

Open
ppamorim wants to merge 1 commit into
flutter:mainfrom
ppamorim:animations-scrim-color
Open

ppamorim wants to merge 1 commit into
flutter:mainfrom
ppamorim:animations-scrim-color

Conversation

@ppamorim

@ppamorim ppamorim commented Nov 19, 2026 •

Copy link
Copy Markdown

Adds an optional scrimColor parameter to OpenContainer. The scrim drawn over the underlying main view during the container transform was hard-coded to Colors.black54, apps couldn't match it to their theme (e.g. a lighter scrim, a tinted scrim, or none at all). This PR adds minimum flexibility for now, a more complete version can be implemented in the future if the team believes it's the best path to follow.

The existing behaviour is unchanged. The fade-in/fade-out tweens are now built per route from this colour with the same weights and curves as before, for both ContainerTransitionType.fade and ContainerTransitionType.fadeThrough.

The scrim fades from a fully transparent scrimColor (rather than transparent black, because the gradient would be broken), so only the alpha animates and lighter or tinted scrims don't darken mid-fade. For the default Colors.black54 this is identical to the previous behaviour. Passing Colors.transparent disables the scrim.

OpenContainer(
  scrimColor: Colors.black26,
  closedBuilder: (BuildContext context, VoidCallback openContainer) => const ListTile(title: Text('Open')),
  openBuilder: (BuildContext context, VoidCallback closeContainer) => const DetailsPage(),
)

Fixes flutter/flutter#59949

Pre-Review Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@github-actions github-actions Bot added p: animations triage-design Should be looked at in design triage P3 Issues that are less important to the Flutter project labels Nov 19, 2026
@ppamorim
ppamorim marked this pull request as ready for review November 19, 2026 03:54

@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 introduces a customizable scrimColor property to OpenContainer to allow customization of the scrim color during route transitions, updating the package version to 3.1.0 and adding corresponding tests. The review feedback notes that the use of withValues and Color.a requires updating the minimum Flutter SDK constraint in pubspec.yaml to >=3.24.0 to avoid compilation errors, and suggests using 0.0 instead of 0 for the alpha parameter for type consistency.

@ppamorim
ppamorim force-pushed the animations-scrim-color branch from 23f77d7 to eeae0af Compare November 19, 2026 03:58
@ppamorim
ppamorim force-pushed the animations-scrim-color branch from eeae0af to a8bed7c Compare November 20, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: animations P3 Issues that are less important to the Flutter project triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[animations] OpenContainer - Add closedElevationColor

1 participant