Skip to content

feat(widget): animation tick before layout (ADR-032 GAP-3)#164

Merged
kolkov merged 1 commit into
mainfrom
fix/gap3-animation-before-layout
Jul 5, 2026
Merged

feat(widget): animation tick before layout (ADR-032 GAP-3)#164
kolkov merged 1 commit into
mainfrom
fix/gap3-animation-before-layout

Conversation

@kolkov

@kolkov kolkov commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Flutter pattern: handleBeginFrame (animate) → handleDrawFrame (layout). Layout must be a pure function of (constraints + widget state) for RelayoutBoundary correctness (Phase 5).

Changes

  • AnimationTicker interface — widgets with layout-affecting animations implement TickAnimation(ctx)
  • tickAnimationsInTree walk in Window.Frame() after BeginFrame, before layout
  • Collapsible: TickAnimation() called by framework, Layout() read-only (no mutation)
  • Transition: TickAnimation() called by framework, Draw() read-only
  • Fade/Slide: paint-only animations stay in Draw(), removed ctx.InvalidateRect calls
  • Replace ctx.Invalidate() with MarkNeedsLayout() in animation ticks
  • All animation tests updated to call TickAnimation before Layout/Draw

Enterprise references

  • Flutter scheduler/binding.dart:1226handleBeginFrame (transient callbacks = animation ticks)
  • Flutter rendering/binding.dart:692drawFrameflushLayout (after all ticks)

Test plan

  • go build ./...
  • go test ./... -count=1 (59 packages, 0 FAIL)
  • golangci-lint run --timeout=5m (0 issues)
  • Visual test: gallery collapsible expand/collapse — animation works
  • CI green

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
app/window.go 50.00% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Flutter pattern: handleBeginFrame (animate) → handleDrawFrame (layout).
Layout must be a pure function of (constraints + widget state) for
RelayoutBoundary correctness (Phase 5).

Changes:
- Add AnimationTicker interface (widget/animation_ticker.go)
- Add tickAnimationsInTree walk in Window.Frame() after BeginFrame
- Collapsible: TickAnimation() called by framework, Layout() read-only
- Transition: TickAnimation() called by framework, Draw() read-only
- Fade/Slide: paint-only, keep updateAnimation in Draw, remove ctx.InvalidateRect
- Replace ctx.Invalidate() with MarkNeedsLayout() in animation ticks
- Update all animation tests to call TickAnimation before Layout/Draw
- Update RENDER-PIPELINE.md with Frame() lifecycle (ADR-032 GAP-3)
- Update CHANGELOG
@kolkov
kolkov force-pushed the fix/gap3-animation-before-layout branch from eb5fe70 to 75fc459 Compare July 5, 2026 11:08
@kolkov
kolkov merged commit 4d3baab into main Jul 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant