Skip to content

[cupertino_ui] Fix CupertinoExpansionTile skipping its fade when toggled by ExpansibleController - #13251

Open
master-wayne7 wants to merge 4 commits into
flutter:mainfrom
master-wayne7:cupertino-expansion-tile-controller-fade
Open

master-wayne7 wants to merge 4 commits into
flutter:mainfrom
master-wayne7:cupertino-expansion-tile-controller-fade

Conversation

@master-wayne7

Copy link
Copy Markdown

In ExpansionTileTransitionMode.fade (the default), CupertinoExpansionTile draws the fade with an OverlayPortal clone of the child, while the in-flow child is kept at zero opacity during the animation. The overlay was only shown from _onHeaderTap, so expanding or collapsing through an ExpansibleController (controller.expand() / controller.collapse()) never showed it: the child popped in at the end of expansion and disappeared at the start of collapse.

This PR makes the tile listen to its ExpansibleController and show the fade overlay on every expansion change, whatever triggered it. The listener is moved over when the controller is swapped in didUpdateWidget and removed in dispose. The header-tap path no longer shows the overlay itself, since the listener now covers it.

Tests:

  • Added Fades the child when toggled by ExpansibleController, which checks that the clone is mid-fade halfway through both expansion and collapse.
  • Updated two existing controller tests that expected one Content widget after controller.expand(). Header taps already produce two (the animating child plus the fading clone), so these expectations reflected the bug.

Fixes flutter/flutter#194264

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: cupertino_ui triage-design Should be looked at in design triage labels Oct 14, 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 CupertinoExpansionTile to listen to its controller's expansion state changes and trigger the fade transition, ensuring the transition occurs when toggled via an ExpansibleController. It also updates existing tests and adds a new test to verify this behavior. The review feedback suggests guarding the _fadeController.show() call in _handleExpansionChanged to only run when widget.transitionMode is ExpansionTileTransitionMode.fade to avoid redundant calls in other transition modes.

Comment thread packages/cupertino_ui/lib/src/expansion_tile.dart
@Piinks
Piinks requested a review from pjkammer October 20, 2026 21:24
@pjkammer pjkammer added the CICD Run CI/CD label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: cupertino_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CupertinoExpansionTile skips its fade when toggled with ExpansibleController

2 participants