Repository navigation
fix: animate_size ignored on Container and Image; False animation values failing to render - #7091
Open
ndonkoHenri wants to merge 5 commits into
Open
ndonkoHenri wants to merge 5 commits into
ndonkoHenri wants to merge 5 commits into
Conversation
ndonkoHenri
added a commit
that referenced
this pull request
Nov 15, 2026
Adds the pull request link to the two 1.1.3 bug-fix entries: animate_size on Container and Image, and False animation values.
Deploying flet-website-v2 with
|
| Latest commit: |
a062724
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://58db222d.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-animate-size-container-5.flet-website-v2.pages.dev |
Python's `AnimationValue` documents `False` as "disable animation", but `parseAnimation()` only handled `True`, an int and an Animation map: a `False` fell through to `value["duration"]` and failed with "Class 'bool' has no instance method '[]'". So `animate=False`, `animate_opacity=False`, `animate_scale=False` and the other `animate_*` properties made the control fail to render (SF-523). `parseAnimation()` now treats `False` as off: it returns `null` (no animation), or a zero-duration animation when the caller passes a default, i.e. animates by default (CupertinoAlertDialog's `inset_animation`, the auto-scroll animation), so those stay instant instead of failing on a missing animation. A doc comment lists the accepted values. Changelog: a 1.1.3 bug-fix entry.
`_sizedControl()` applies a control's width/height, its `animate_size` AnimatedSize and its min/max constraints. Controls that size themselves (Container and Image list `width`/`height` in `skip_properties`) skipped the AnimatedSize together with the size box, so `animate_size` had no effect on them (#5766). The reporter's case: a Container whose height goes from a fixed value to `None` (its content's size) and back jumped instead of animating. Such controls are now wrapped in AnimatedSize when `animate_size` is set. AnimatedSize follows the size the control lays out at, so it animates changes between fixed sizes and to/from the natural size. The min/max constraints are still applied around it. Controls that don't size themselves keep the AnimatedSize in `_fixedSizeControl()`; both paths read `animate_size` with `getAnimation()`, so `animate_size=False` means no animation. The doc comment of `_sizedControl()` describes this. Changelog: a 1.1.3 bug-fix entry.
Two integration tests in `integration_tests/controls/core/ test_layout_control.py` (real desktop client), with a `_wait_for()` helper that pumps frames until events reach Python: - test_animate_size: a Container with `animate_size=400`, a 200 px tall content and an `on_size_change` handler (`size_change_interval=0`) goes from height 40 to `None` and back to 40; each change must report heights between 40 and 200, not a single jump. - test_animate_false: a Container with `animate`, `animate_opacity`, `animate_size`, `animate_scale`, `animate_rotation`, `animate_offset` and `animate_margin` all `False` renders and shows its text. On macOS both pass with this branch and fail with main's `base_controls.dart` and `animations.dart`: "no animation: [200.0]" (a straight jump) and the text not found (the Container failed to render).
Adds the pull request link to the two 1.1.3 bug-fix entries: animate_size on Container and Image, and False animation values.
FeodorFitsner
force-pushed
the
fix/animate-size-container-5766
branch
from
November 19, 2026 20:35
35b9584 to
a062724
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5766.
Two animation bugs in the shared layout code.
animate_sizeonContainerandImageanimate_sizehad no effect onContainerorImage. The reporter's case, a container hidden withheight=0and revealed withheight=None, jumped instead of animating.Why:
_sizedControl()applies a control'swidth/height, wraps it inAnimatedSizeforanimate_size, and applies its min/max constraints.ContainerandImagesize themselves, so they listwidth/heightinskip_properties, and that skipped theAnimatedSizealong with the size box.Fix: controls that size themselves are wrapped in
AnimatedSizewhenanimate_sizeis set.AnimatedSizefollows the size the control lays out at, so changes between fixed sizes and to/from the natural size (None) animate. The min/max constraints are still applied around it.Falseanimation valuesPython documents
Falseas "disable animation" for everyanimate_*property, but the client failed on it ("Class 'bool' has no instance method '[]'"), so a control withanimate=False,animate_opacity=Falseand so on didn't render.Fix:
parseAnimation()treatsFalseas off: no animation, or a zero-duration (instant) one where the control animates by default, such asCupertinoAlertDialog.inset_animationand the auto-scroll animation.Testing
Integration tests in
integration_tests/controls/core/test_layout_control.py, real macOS desktop client:maintest_animate_sizeContainerwithanimate_size=400reports its height throughon_size_changewhile going from 40 toNone(its content's 200) and back; checks in-between heights arrive[200.0], a straight jumptest_animate_falseContainerwithanimate,animate_opacity,animate_size,animate_scale,animate_rotation,animate_offsetandanimate_marginallFalseFull
packages/fletFlutter suite: 183 pass;flutter analyzeclean.Summary by Sourcery
Fix shared layout animation handling so self-sizing controls animate size changes correctly and
Falseanimation settings disable animations without preventing rendering.New Features:
ContainerandImagecontrols, including transitions to and from natural size.Bug Fixes:
Falseanimation values as disabled so controls render correctly when individual or general animations are turned off.Enhancements:
Documentation:
on_size_changereporting.Tests: