Skip to content

perf(main): optimize sidebar spring animation and eliminate full-slot offscreen Opacity compositing #900

Description

@ZhuchkaTriplesix

Summary

In MainScreenState._buildAnimatedSidebar (lib/features/main_screen/main_screen.dart), sidebar collapse and expand are animated using physics springs (_sidebarWidthSpring).

Inside the animation builder (lines 1361–1364):

child: Opacity(
  opacity: contentOpacity,
  child: material.RepaintBoundary(
    child: _ConnectionsPanelSlot(...),
  ),
),

Because Opacity is placed outside RepaintBoundary and animates continuously on every tick of the spring (60–120 Hz), Flutter cannot reuse the cached raster layer of _ConnectionsPanelSlot. Instead, Flutter is forced to allocate and composite an intermediate offscreen buffer (saveLayer) on every frame for the entire connection tree (all database connections, schemas, tables, views, status indicators, badges).

On Linux and Windows systems (especially with integrated graphics or software compositing), this causes significant frame drops and stutter during sidebar collapse/expand.

Scope

  • Ensure the static content of _ConnectionsPanelSlot is cached in its raster layer without invalidating it via parent opacity, or use layer-based opacity / avoid full offscreen compositing when opacity is 1.0 or 0.0.
  • When sidebar width reaches collapse threshold, cleanly detach or offstage the connection panel to stop ticker and paint passes.

Out of scope

  • Changing the physics parameters of QueryaSpring.snappy.

Activity

  1. added this to the 0.4.18 milestone on Sep 23, 2026
  2. added
    performanceTheme parser epic label: performance
    motionAnimation system, transitions, motion tokens
    uiUser interface components and widgets
    on Sep 23, 2026
  3. ZhuchkaTriplesix commented on Sep 27, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Resolved by #955 (already merged into dev; not auto-closed since this repo's default branch is main and PRs merge into dev).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

motionAnimation system, transitions, motion tokensperformanceTheme parser epic label: performanceuiUser interface components and widgets

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions