liquid_glass_widgets 1.25.1
liquid_glass_widgets: ^1.25.1 copied to clipboard
iOS 26/27-style liquid glass widgets for Flutter. Built on a custom fragment shader for real blur, liquid interactions, specular highlights, and chromatic aberration.
Liquid Glass Widgets #
Bring Apple's iOS 27 & iOS 26 Liquid Glass design system to Flutter — with authentic optical refraction, lifted touch lenses, fluid spring morphing, and zero third-party dependencies.
Quick Start · iOS 27 Comparison · Widget Catalog · Performance · AI Skill · Docs
Captured on iOS 27.0 Simulator (GlassStyle.ios27) · Left: lifted control lenses · Center: Apple Mail liquid morphs & pinned chrome · Right: Apple Music refraction & scroll-to-minimize.
Why liquid_glass_widgets? #
- Authentic iOS 27 & iOS 26 Look (
GlassStyle.ios27/ios26) — Calibrated directly against native iOS 27 & iOS 26 SwiftUI/UIKit: realistic glass refraction, frosted depth, soft rim highlights, and lifted magnifying lenses onGlassTabBar,GlassSegmentedControl,GlassSwitch, andGlassSlider. - Smooth 120 Hz Performance — Built for ProMotion displays: ~2.0 ms raster on
GlassScaffoldchrome and 2.5–2.7 ms (0missed frames, 120 Hz locked) on grouped scrolling glass lists on iPhone 16 Pro, with resting switches, sliders, and segmented controls using 0 active shaders. - 60+ Drop-In Cupertino Widgets — Complete navigation, form, list, picker, menu, sheet, and dialog library including
GlassScaffold,GlassTabBar(.bottom,.inline,.searchable,.minimizable),GlassAppBar.pinned,GlassModalSheet,GlassMenu,GlassDatePicker, andGlassSurfaceStyle.solidfor opaque scrolling cards. - Fluid Liquid Morphing — Continuous spring-based teardrop and droplet morphs from any trigger button into
GlassMenu,GlassPullDownButton,GlassPopover,showGlassConfirmationDialog, andGlassModalSheet. - Cross-Platform & Zero Dependencies — Pure Flutter SDK (
flutter: sdk: flutter). Automatically uses full Impeller glass on iOS, Android, and macOS, with lightweight glass and frosted fallbacks on Web, Windows, and Linux. - Accessibility, Keyboard & RTL Built In — Respects Reduce Motion, Increase Contrast, and iOS On/Off switch labels, with 44 pt tap targets, VoiceOver/TalkBack semantics, full keyboard navigation, and RTL support out of the box.
Native iOS 27 Comparison #
Interactive controls are iteratively tuned side-by-side against native iOS 27.0 across two visual tiers: GlassQuality.premium (default for floating chrome, overlays, and lifted lenses on Impeller) and GlassQuality.standard (lightweight shader for Web, Desktop, Skia, and dense body surfaces).
Light Mode — Lifted Lenses (Native iOS 27.0 vs. Flutter Premium vs. Flutter Standard)
Dark Mode — Lifted Lenses (Native iOS 27.0 vs. Flutter Premium vs. Flutter Standard)
Side-by-side iOS 27.0 Simulator captures with all four interactive lenses lifted simultaneously (top bar hosts the harness controls).
Quick Start #
1. Install #
flutter pub add liquid_glass_widgets
Requires Flutter ≥ 3.41.0 (Dart ≥ 3.5.0). Keep cupertino_icons: ^1.0.8 in your pubspec.yaml for Cupertino icons:
dependencies:
liquid_glass_widgets: ^1.25.1
cupertino_icons: ^1.0.8
2. Initialize & Wrap #
Preload shaders in main() and wrap your app with LiquidGlassWidgets.wrap():
import 'package:flutter/cupertino.dart';
import 'package:liquid_glass_widgets/liquid_glass_widgets.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await LiquidGlassWidgets.initialize();
runApp(LiquidGlassWidgets.wrap(child: const MyApp()));
}
3. Build Your First iOS 27 Screen #
Use GlassScaffold for each screen — it handles floating glass bars, backdrop sharing, safe areas, and scroll edges automatically:
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _tab = 0;
int _range = 0;
bool _notifications = true;
@override
Widget build(BuildContext context) {
return GlassScaffold(
appBar: GlassAppBar(title: const Text('Settings')),
bottomBar: GlassTabBar.bottom(
selectedIndex: _tab,
onTabSelected: (i) => setState(() => _tab = i),
tabs: const [
GlassTab(icon: Icon(CupertinoIcons.slider_horizontal_3), label: 'Controls'),
GlassTab(icon: Icon(CupertinoIcons.layers_alt_fill), label: 'Surfaces'),
GlassTab(icon: Icon(CupertinoIcons.sparkles), label: 'Lenses'),
],
),
body: ListView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
children: [
// Keep scrolling cards opaque (GlassSurfaceStyle.solid) — zero shader cost,
// while interactive controls inside keep their lifted iOS 27 glass lenses.
GlassGroupedSection(
surfaceStyle: GlassSurfaceStyle.solid,
header: const Text('PREFERENCES'),
children: [
Padding(
padding: const EdgeInsets.all(12),
child: GlassSegmentedControl(
segments: const [
GlassSegment(label: 'Day'),
GlassSegment(label: 'Week'),
GlassSegment(label: 'Month'),
],
selectedIndex: _range,
onSegmentSelected: (i) => setState(() => _range = i),
),
),
MergeSemantics(
child: GlassListTile(
title: const Text('Notifications'),
trailing: GlassSwitch(
value: _notifications,
onChanged: (v) => setState(() => _notifications = v),
),
),
),
],
),
],
),
);
}
}
Using MaterialApp or Flutter 3.50+ package:cupertino_ui?
MaterialApp: PassbrightnessResolver: Theme.maybeBrightnessOfso glass widgets follow yourThemeMode, and wrapMaterialApp.builderin a transparentMaterialif you don't mount a MaterialScaffold:runApp(LiquidGlassWidgets.wrap( brightnessResolver: Theme.maybeBrightnessOf, child: MaterialApp( builder: (context, child) => Material(type: MaterialType.transparency, child: child!), home: const MyHomePage(), ), ));- Flutter 3.50+
package:cupertino_ui: Add Flutter's bridge toCupertinoApp.buildersoCupertinoThemeand localizations propagate cleanly:builder: (context, child) => CupertinoUiCompatibilityBridge(child: child!),
Glass vs. Content — Design Philosophy #
On iOS 26 and iOS 27, glass belongs on floating navigation and controls, while scrolling cards and content rows stay opaque:
| Use Glass For | Keep Opaque (GlassSurfaceStyle.solid) |
|---|---|
Navigation bars (GlassAppBar), tab bars (GlassTabBar), toolbars (GlassToolbar) |
Inset-grouped list cards (GlassGroupedSection, GlassContainer.card) |
Floating buttons (GlassButton, GlassIconButton, GlassPullDownButton) |
List rows (GlassListTile), feed items, media cells |
Overlays (GlassModalSheet, GlassDialog, GlassMenu, GlassPopover) |
Buttons, toggles & text fields inside solid cards (auto-inherited) |
Active lifted lenses (GlassSwitch, GlassSlider, GlassSegmentedControl) |
Full-screen backgrounds |
Tip: Avoid nesting refractive glass buttons inside a
glass-mode container (they automatically fall back to vibrancy fills to prevent double-refraction). PasssurfaceStyle: GlassSurfaceStyle.solidto scrolling cards and sections — nested buttons, inputs, and pickers inheritsolidautomatically while switches, sliders, and segmented controls keep their lifted glass lenses on touch.
Signature Interactions & Navigation #
Left: Dark Mode lifted lenses on GlassSegmentedControl, GlassSwitch, GlassSlider, and GlassTabBar · Right: GlassMenu teardrop spring physics in Apple Messages.
Liquid Morph Sheets & Menus #
Wrap any trigger in GlassMorphTrigger and pass its anchor to GlassModalSheet.show(morphFrom:) (or showGlassConfirmationDialog(morphFrom:)) for a continuous droplet morph:
GlassMorphTrigger(
builder: (context, anchor) => GlassIconButton(
icon: const Icon(CupertinoIcons.square_pencil),
onPressed: () => GlassModalSheet.show<void>(
context: context,
morphFrom: anchor,
detents: const {GlassSheetDetent.fitted},
builder: (context) => const ComposeSheetBody(),
),
),
)
Guides:
docs/LIQUID_MORPH_ENGINE.md·docs/GLASS_MODAL_SHEETS_GUIDE.md
Scroll-to-Minimize Tab Bar (GlassTabBar.minimizable) #
Mirrors SwiftUI's .tabBarMinimizeBehavior(_:), collapsing the tab bar into the active tab circle on scroll (just like Apple Music):
final _scroll = ScrollController();
final _minimize = GlassTabBarMinimizeController(
behavior: GlassBarMinimizeBehavior.onScrollDown,
);
GlassScaffold(
body: ListView.builder(controller: _scroll, itemBuilder: ...),
bottomBar: GlassTabBar.minimizable(
tabs: _tabs,
selectedIndex: _index,
onTabSelected: (i) => setState(() => _index = i),
minimizeController: _minimize,
scrollController: _scroll,
onMinimizedTabTap: _minimize.expand,
),
)
- Pinned Navigation Chrome (
GlassNavigationShell+GlassAppBar.pinned): Keeps bars pinned across route pushes with matching item morphs and bezel-clipped transitions. Seedocs/GLASS_NAVIGATION_TRANSITION.md. - Content-Aware Brightness: Enable
contentAwareBrightness: trueonGlassScaffoldandadaptiveBrightness: trueonGlassTabBar.bottomto flip bar foregrounds automatically over light and dark scrolling content.
Widget Catalog #
All 60+ widgets and scopes are exported from package:liquid_glass_widgets/liquid_glass_widgets.dart:
| Category | Exported Widgets & Primitives |
|---|---|
| Containers & Lists | GlassContainer · GlassContainer.card · GlassGroupedSection · GlassListTile · GlassDivider · GlassDisclosureGroup · GlassReorderableList · GlassStepper · GlassSwipeActions · GlassSwipeActionScope |
| Interactive Controls | GlassButton · GlassIconButton · GlassToggle.button · GlassSwitch · GlassSlider · GlassSegmentedControl (.scrollable) · GlassPullDownButton · GlassButtonGroup · GlassBadge · GlassPageControl · GlassEditButton · GlassEditScope |
| Inputs & Pickers | GlassTextField · GlassTextArea · GlassPasswordField · GlassSearchBar · GlassPicker · GlassFormField · GlassDatePicker (.compact / .graphical / .wheel) · GlassMultiDatePicker |
| Surfaces & Navigation | GlassScaffold · GlassPage · GlassPageRoute · GlassPageTransitionsBuilder · GlassAppBar (.pinned) · GlassBarItem · GlassLargeTitle · GlassTabBar (.bottom / .inline / .searchable / .minimizable) · GlassTabBarExtraButton · GlassTabBarTrailingButton · GlassToolbar · GlassNavigationShell · GlassNavigationStack · GlassNavigationLink · GlassPinnedBarChrome · GlassVerticalBar · GlassScrollEdgeEffect |
| Overlays & Modals | GlassModalSheet · GlassModalSheetScaffold · GlassMorphTrigger · GlassDialog · showGlassConfirmationDialog · GlassMenu (GlassMenuItem, GlassMenuDivider, GlassMenuLabel) · GlassPopover · GlassContextMenu · GlassFullScreenCover |
| Feedback & Effects | GlassProgressIndicator · GlassToast · GlassMaterialize · GlassMaterializeTransition · ProgressiveBlur · GlassGlow |
| Theming & Scopes | GlassTheme · GlassBackdropGroup (.hoisted) · AdaptiveGlass · AdaptiveLiquidGlassLayer · LiquidGlassLayer · LiquidGlassBlendGroup · LiquidGlassScope · GlassBackgroundSource · GlassContentAwareScope · GlassIsolationScope · GlassAccessibilityScope · GlassAdaptiveScope · GlassMotionScope · GlassInteractionSilence · IndicatorLensOptics · IndicatorJellyPhysics |
Theming & Styles #
All widgets default to GlassStyle.ios27. Switch styles or customize themes app-wide via LiquidGlassWidgets.wrap():
runApp(LiquidGlassWidgets.wrap(
child: const MyApp(),
theme: const GlassThemeData.ios27(), // default — iOS 27 look
// theme: const GlassThemeData.ios26(), // iOS 26 look
// theme: const GlassThemeData.minimal(), // shader-free frosted fallback
));
- Use
LiquidGlassSettings.clear(context)for Apple's clear glass look over rich photos or video. - Quality tiers:
GlassQuality.premium(default for floating chrome, overlays & active lenses on Impeller),GlassQuality.standard(default for body glass, Web & Desktop),GlassQuality.minimal(shader-freeBackdropFilter), andGlassSurfaceStyle.solid(opaque native cards). - Override priority: Widget
settings:/quality:→ localGlassTheme/GlassPage(themeOverride:)→LiquidGlassWidgets.wrap(theme:).
Optional Wallpaper Refraction on Skia and Web (LiquidGlassScope)
On Skia and Web (GlassQuality.standard), indicator lenses can refract a wallpaper image without Impeller's backdrop texture capture. Passing background: to GlassScaffold or GlassPage wires this up automatically; for custom stacks, wrap with LiquidGlassScope and GlassBackgroundSource:
LiquidGlassScope(
child: Stack(
children: [
Positioned.fill(
child: GlassBackgroundSource(child: Image.asset('assets/wallpaper.jpg')),
),
Center(
child: GlassSegmentedControl(
segments: const [GlassSegment(label: 'Day'), GlassSegment(label: 'Week')],
selectedIndex: 0,
onSegmentSelected: (_) {},
quality: GlassQuality.standard,
),
),
],
),
)
Performance #
Measured on physical iPhone 16 Pro (120 Hz ProMotion): ~2.0 ms raster on GlassScaffold chrome and 2.5–2.7 ms raster (0 missed frames, 120 Hz locked) on grouped scrolling glass lists (GlassBackdropGroup.hoisted) across Light and Dark modes, with up to 51% lower Light-mode GPU memory on scrolling glass lists.
- Use
GlassScaffoldso floating bars automatically share backdrop reads. - Use
GlassSurfaceStyle.solidfor dense scrolling feed cards. - Wrap scrolling refractive glass lists in
GlassBackdropGroup.hoistedto keep scrolling locked at 120 Hz. - Enable
adaptiveQuality: true(experimental) onLiquidGlassWidgets.wrap()to step quality down automatically under thermal throttling.
Full iPhone 16 Pro Light + Dark benchmark tables, reproduction commands, and engine architecture:
docs/PERFORMANCE.md
Platform Support & Accessibility #
- Platforms: Full Impeller glass on iOS, Android, and macOS; lightweight glass on Web (CanvasKit/Wasm), Windows, and Linux. Automatically uses Flutter
3.50+hardware bilinear backdrop sampling when available while remaining compatible with Flutter>=3.41.0. - Maps, WebViews & Video (
PlatformView): PassplatformViewBackdrop: trueonGlassModalSheet,GlassMenu, orGlassPopover, or setplatformViewMode: PlatformViewGlassMode.passthroughon floating bars. Seedocs/PLATFORM_SUPPORT.md. - Accessibility, Keyboard & RTL: Honours system Reduce Motion, Increase Contrast / Reduce Transparency, and iOS On/Off switch labels automatically, with ≥ 44 pt touch/semantic targets, VoiceOver/TalkBack roles & heading levels, full keyboard navigation, and RTL layouts.
AI Coding Agent Skill #
Building with Antigravity, Cursor, Claude Code, or GitHub Copilot? Install the official skill so your assistant generates idiomatic liquid_glass_widgets code:
- Antigravity / Gemini CLI:
mkdir -p .agents/skills/liquid-glass-widgets curl -sSL https://raw.githubusercontent.com/sdegenaar/liquid_glass_widgets/main/skills/liquid-glass-widgets/SKILL.md \ -o .agents/skills/liquid-glass-widgets/SKILL.md - Claude Code: Save
skills/liquid-glass-widgets/SKILL.mdto.claude/skills/liquid-glass-widgets/SKILL.md. - Cursor: Copy
skills/liquid-glass-widgets/SKILL.mdto.cursor/rules/liquid-glass.mdc. - Other IDEs: See
skills/README.md.
Showcase Apps & Demos #
Explore full iOS 27 reference apps and isolated component demos inside example/:
| Showcase App | Run Command |
|---|---|
| Widget Catalog (iOS 27 / iOS 26) | cd example && flutter run |
| Apple Mail (Pinned Chrome & Morphs) | cd example && flutter run -t lib/apple_mail/apple_mail_demo.dart |
| Apple Music (Searchable & Minimizable Bar) | cd example && flutter run -t lib/apple_music/apple_music_demo.dart |
| Apple Podcasts | cd example && flutter run -t lib/apple_podcasts/apple_podcasts_demo.dart |
| Apple Messages (Teardrop Menus) | cd example && flutter run -t lib/apple_messages/apple_messages_demo.dart |
| Apple News | cd example && flutter run -t lib/apple_news/apple_news_demo.dart |
| Apple Lock Screen | cd example && flutter run -t lib/apple_lockscreen/keypad_lock_screen_demo.dart |
| Wanderlust (Travel Showcase) | cd example/showcase && flutter pub get && flutter run |
15 Focused Component Demos (example/lib/demos/)
| Demo | Run Command (from example/) |
|---|---|
indicator_parity_demo.dart — all 4 lifted lens controls side-by-side |
flutter run -t lib/demos/indicator_parity_demo.dart |
glass_modal_sheet_demo.dart — peek / half / full / fitted + droplet morph |
flutter run -t lib/demos/glass_modal_sheet_demo.dart |
glass_menu_demo.dart — all 9 teardrop menu alignments |
flutter run -t lib/demos/glass_menu_demo.dart |
minimizable_bar_demo.dart — scroll-to-minimize & bottomAccessory |
flutter run -t lib/demos/minimizable_bar_demo.dart |
searchable_bar_demo.dart — morphing searchable bottom bar |
flutter run -t lib/demos/searchable_bar_demo.dart |
tab_bar_menu_demo.dart — native pull-down menus on tab bars |
flutter run -t lib/demos/tab_bar_menu_demo.dart |
glass_tab_bar_bottom_demo.dart — lifted tab bar lens masking |
flutter run -t lib/demos/glass_tab_bar_bottom_demo.dart |
glass_tab_bar_scrollable_demo.dart — scrollable inline tab bar |
flutter run -t lib/demos/glass_tab_bar_scrollable_demo.dart |
bottom_bar_tab_width_demo.dart — tabWidth layout patterns |
flutter run -t lib/demos/bottom_bar_tab_width_demo.dart |
nav_bar_patterns_demo.dart — GlassAppBar.pinned & nested nav morphs |
flutter run -t lib/demos/nav_bar_patterns_demo.dart |
content_aware_brightness_demo.dart — light/dark bar adaptation |
flutter run -t lib/demos/content_aware_brightness_demo.dart |
color_fidelity_demo.dart — LiquidGlassSettings.clear vs regular glass |
flutter run -t lib/demos/color_fidelity_demo.dart |
quality_comparison_demo.dart — Premium vs Standard vs Minimal |
flutter run -t lib/demos/quality_comparison_demo.dart |
lists_pickers_and_nav_demo.dart — swipe actions, reorder, pickers, nav stack |
flutter run -t lib/demos/lists_pickers_and_nav_demo.dart |
shape_debug_demo.dart — superellipse & custom GlassButton shapes |
flutter run -t lib/demos/shape_debug_demo.dart |
Documentation #
| Guide | What It Covers |
|---|---|
| Performance & Benchmarks | iPhone 16 Pro Light/Dark benchmarks, 120 Hz tuning & GPU architecture |
| Architecture & Engineering Design | 5-layer architecture, GPU shaders, and provenance standards |
| iOS 26 & 27 Optics Spec | CoreAnimation glassFace optical laws, GPU invariants & calibration briefs |
| Platform Support Matrix | Renderer tiers, PlatformViews, and cross-platform shader compatibility |
| Liquid Morph Engine | Spring physics & custom teardrop/droplet morph integration |
| Modal Sheets Guide | Full GlassModalSheet API, fitted detents, solid style & scroll sync |
| Navigation & Pinned Chrome | GlassNavigationShell, GlassAppBar.pinned, bezel clips & iPhone Duo bars |
| Adaptive Quality Calibration | GlassAdaptiveScope benchmarks, cold-start persistence & diagnostics |
| Progressive Blur & Popover Blur Ramp | Variable blur overlays and popover ramp optics |
| Roadmap | Planned milestones and 2.0.0 roadmap |
| Migration Guide (0.x → 1.0) | Breaking changes and upgrade path from 0.x |
| AI Agent Skill & Contributor Guide | Consumer AI skill & repository contribution/shader guidelines |
Credits & License #
Zero third-party pubspec.yaml dependencies. Built exclusively on the Flutter SDK (flutter: sdk: flutter).
Special thanks to Tim Lehmann (whynotmake.it) and the whynotmake-it team:
liquid_glass_renderer(MIT License): Pioneered the foundational fragment shader pipeline, blend group tracking, and texture capture architecture maintained in-tree inlib/src/engine/.motor(MIT License): Designed theCupertinoMotionspring physics model adapted inlib/utils/glass_spring.dart.
See THIRD_PARTY_NOTICES and lib/src/engine/ATTRIBUTION.md for complete notices. Contributions are welcome — see AGENTS.md. Licensed under MIT (LICENSE).
