name: liquid_glass description: Expert guidance for implementing the "Liquid Glass" design language (iOS 26 Style) in Flutter. Focuses on translucency, spatial depth, "ExtendBody" scroll management, and the "Extra Button" contextual action pattern. metadata: version: "1.0"
Liquid Glass Design System
Overview
Liquid Glass is a design philosophy (introduced in iOS 26) that prioritizes translucency and spatial depth to create a sense of openness in mobile applications. By making UI "chrome" (App Bars, Bottom Bars) translucent and allowing content to flow behind them, the application feels more spacious and "alive." This skill provides the architectural blueprints for implementing these patterns in Flutter.
Quick Reference
Core Principles:
- Transparency: UI elements are overlays, not walls.
- Spatial Depth: Content flows edge-to-edge behind bars.
- Contextual Action: Navigation bars morph to accommodate screen-specific actions.
The "ExtendBody" Rule:
Always use Scaffold(extendBody: true) to inflate MediaQuery.padding.bottom and allow content to scroll behind the bottom bar.
Scroll Spacer Pattern (for CustomScrollView):
SliverToBoxAdapter(
child: SizedBox(height: MediaQuery.paddingOf(context).bottom),
)
Layout & Scroll Management
To achieve the glass effect, content must exist underneath the UI bars.
Using Scaffold(extendBody: true)
Setting extendBody: true tells the Scaffold to extend its body to the bottom of the screen, even if a bottomNavigationBar is present. It also inflates the MediaQuery.padding.bottom to match the bar's height.
- ListView/GridView: Automatically respect the inflated padding.
- CustomScrollView: Ignores it. You must manually add a bottom spacer sliver.
- SingleChildScrollView: Requires manual padding inside its child.
Component Implementation
1. Independent Overlay App Bar
Avoid SliverAppBar for complex Liquid Glass effects because it ties foreground and background heights together. Instead, use a Stack at the Scaffold level.
Layering Strategy:
- Scroll View: The main content.
- Darkening Overlay: A
LinearGradientthat fades in as the user scrolls. - Foreground: The Title, Back button, and Actions.
The "No Hard Edge" Gradient: Use non-linear stops for a natural falloff:
LinearGradient(
stops: [0.0, 0.3, 0.5, 0.65, 0.8],
colors: [
for (final alpha in [1.0, 0.98, 0.64, 0.19, 0.0])
baseColor.withValues(alpha: alpha * scrollProgress),
],
)
2. The Morphing Bottom Bar
The bar is composed of two independent containers in a Row: the Tabs Area and the Extra Button.
Morphing Rules:
- Geometry Only: Animate
widthandborderRadius. Never animate glassopacity(causes blur artifacts). - Content Gap Crossfade:
- Old content fades out: 0.0 → 0.4
- Gap (empty): 0.4 → 0.6
- New content fades in: 0.6 → 1.0
- Physics: Use
CupertinoMotionwithduration: 350msandbounce: 0.25.
3. Syncing Blur (Pinned Headers)
When a SliverPersistentHeader pins, it should signal the App Bar to also activate blur.
- Use
overlapsContentfromSliverPersistentHeaderDelegate. - Communicate state via a
ChangeNotifierto the Scaffold.
Best Practices
Design Principles
- Never box content: Avoid opaque horizontal bars.
- Use Gradients for Fading: Simple gradients are often better than heavy shaders for "no hard edge" effects.
- Platform Mental Models: Remember that iOS handles scroll insets automatically (
adjustedContentInset), while Flutter requires manual coordination for low-level widgets.
Implementation Guidelines
- Centralize with Wrappers: Create a
LiquidGlassScaffoldthat handles theCustomScrollViewbottom spacer and App Bar layering automatically. - Primitive Abstraction: Keep your rendering engine (like
liquid_glass_renderer) behind a clean boundary so it can be swapped if Flutter adds official support. - Position FABs Precisely: Set
resizeToAvoidBottomInset: falseand position FABs using the inflatedMediaQuery.padding.bottomso they sit above the bar and shift with the keyboard.
Resources
References
- GitHub Issue #105027 - Discussion on Scaffold padding and CustomScrollView.
liquid_glass_renderer- Community package for glass primitives.motor- Package forCupertinoMotionspring physics.