NIB / PLAYGROUND
Liquid glass playground — NibComponents
Try liquid glass in Flutter. Explore clear and depth water, merging drops and shared bubbles over a live Flutter subtree.
Open interactive viewExplore clear and depth water, merging drops and shared bubbles over a live Flutter subtree.
Read the full component guide and API
Public widgets and APIs
- NibWaterGlass
- NibWaterSurface
- NibWaterController
- NibWaterConfig
- NibWaterDrop
- NibWaterImpulse
- NibWaterInteraction
- NibWaterPhase
- NibWaterRenderPath
- NibWaterRenderStatus
- NibWaterSampling
- NibWaterQuality
- NibWaterMaterial
- NibBubbleEmitter
- NibLiquidGlass
- glassLightFromPointer
- NibGlass
Example Dart code
import 'package:flutter/material.dart';
import 'package:nib_components/nib_components.dart';
import 'package:nib_motion/nib_motion.dart';
void main() => runApp(const MaterialApp(home: WaterExample()));
class WaterExample extends StatefulWidget {
const WaterExample({super.key});
@override
State<WaterExample> createState() => _WaterExampleState();
}
class _WaterExampleState extends State<WaterExample> {
final water = NibWaterController(drops: const [
NibWaterDrop(id: 1, center: Offset(90, 130), radius: 48),
NibWaterDrop(id: 2, center: Offset(270, 130), radius: 48),
]);
@override
void dispose() {
water.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => Scaffold(
body: SafeArea(child: Center(child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(width: 360, height: 260, child: NibWaterGlass(
controller: water,
surface: true,
animated: true,
sampling: NibWaterSampling.live,
background: const ColoredBox(
color: Color(0xFFECEBE5),
child: GridPaper(
color: Color(0xFF969B96), interval: 20,
divisions: 1, subdivisions: 1,
child: Center(child: Text('Look through the water',
style: TextStyle(color: Color(0xFF202724)))),
),
),
)),
TextButton(
onPressed: () => water.disturb(const Offset(180, 130)),
child: const Text('Make a wave'),
),
],
))),
);
}Playground controls
| Control | Type | Options or range | Help |
|---|---|---|---|
| Material | choice | water, legacy | Water Lab is the new review target. Legacy keeps the existing glass available. |
| Scene | choice | droplets, surface, component, bubbles | All scenes use NibWaterSurface. Bubbles uses one bounded emitter and one shared sample. |
| Pointer mode | choice | drag, disturb | Drag moves a drop. Disturb adds waves and a movement wake. |
| Background | choice | grid, typography, image, scrolling | Neutral grid and text reveal refraction. Image is original local vector art; scrolling has a Move background button. |
| Disturbance strength · px | number | 0.0–12.0 | Artistic height amplitude, not physical pressure. |
| Wave speed · px/s | number | 40.0–400.0 | How quickly a disturbance propagates in receiver-local pixels. |
| Damping · /s | number | 0.3–8.0 | Higher damping removes waves sooner. |
| Optical strength | number | 0.0–40.0 | Artistic background displacement. Zero removes refraction; this is not a physical refractive index. |
| Surface highlight | number | 0.0–1.0 | Light intensity follows the evolving surface normal. |
| Wavelength · px | number | 16.0–120.0 | Distance between wave crests in local logical pixels. |
| Shape recovery · /s | number | 2.0–30.0 | Controls how quickly the drop arrangement approaches merge or split targets. |
| Sampling policy | choice | live, static, throttled, legacy | Live samples child layers during composition. Static requires explicit invalidation; throttled permits older input. Legacy preserves the old asynchronous path. |
| Water optics | choice | clear, depth | Clear adds no deliberate blur. Depth adds bounded artistic absorption; it is not volumetric fluid simulation. |
| Quality · multiple of DPR | number | 0.25–2.0 | Device-relative requested scale; bounded to four million pixels, 16 MB input and 4096 pixels per axis. Effective size is shown in Development details. |
| Intentional blur · logical px | number | 0.0–8.0 | Opt-in source blur, independent of resolution and wave speed. Zero preserves clear content. |
| Legacy sampling · pixels/logical px | number | 0.5–2.0 | Only the legacy sampling policy uses this absolute scale; its two-million-pixel cap is unchanged. |
| Backdrop | choice | grid, content | Changes the local scene behind the glass; the website stays dark. |
| Shape | choice | rounded, capsule | Both shapes use the real borderRadius property. |
| Note text | text | Foreground content stays independent of the glass filter. | |
| Animated press | toggle | Enabled in this demo. Uses NibMotion and a 0.98 press scale. | |
| Pointer response | toggle | Controls decorative light tracking and press response, not the child button. | |
| Backdrop blur | number | 0.0–20.0 | Gaussian blur on both renderer paths. |
| Rim highlight | number | 0.0–1.0 | Lighting intensity. The extra border is controlled separately. |
| Extra border | toggle | Adds the component outline; the engine rim can remain visible when this is off. | |
| Dome thickness | number | 1.0–48.0 | Shader path only; logical pixels. This does not change layout size. |
| Refraction index | number | 1.0–1.8 | Shader path only. 1.0 requests no bending. |
| Color dispersion | number | 0.0–0.15 | Shader path only. Zero disables the extra red/blue sampling. |
| Backdrop saturation | number | 0.0–2.0 | Shader path only. 1.0 leaves backdrop saturation unchanged. |
Water Lab uses the stable public water API. The refractive path must be checked in a real browser; fallback rendering does not satisfy visual review.
The model preserves source-region area as a 2D mass proxy. It does not conserve exact silhouette area or solve 3D fluid flow.
Capture is restricted to the designated bounded background. Platform views and content outside that subtree are not supported background inputs.
Android GPU, physical touch and screen-reader validation remain separate checks after maintainer web review.