Liquid Glass Easy

The lens and its style

One widget, one flat style object: shape, lights, fill and refraction.

Dart
LiquidGlassLens({
  LiquidGlassStyle style = const LiquidGlassStyle(),
  bool visibility = true,
  LiquidGlassTouch? touch,
  bool? useImpellerBackdrop,
  Widget? child,
})

Size comes from layout, never from the lens. The child is clipped to the glass shape. visibility: false switches the glass off instantly — no backdrop cost, no child — so it is the cheap way to hide a lens you will show again.

LiquidGlassStyle#

Everything about how a lens looks lives in one object, and every field sits directly on it — no nested groups — so changing one facet is one copyWith(...). merge(other) is there for theme and override patterns, and the components describe their glass with the same object.

Dart
LiquidGlassStyle({
  LiquidGlassShape? shape,        // null → the consumer's default outline
  LiquidGlassLight? specular,     // null → the consumer's default highlight
  LiquidGlassLight? glow,         // null → the consumer's default (none on a lens)
  double refractionIndex = 1.1,
  double refractionWidth = 12,
  double magnification = 1.0,
  double dispersion = 0,
  double saturation = 1.0,
  double blur = 0,
  Color color = const Color(0x00000000),
  LiquidGlassShadow? shadow,
  LiquidGlassAdaptivity? adaptivity,
  bool liteGlass = false,
})

// Change one facet, keep the rest.
final frosted = style.copyWith(blur: 4, color: const Color(0x22FFFFFF));

Shape#

ConstructorCorner curve
LiquidGlassShape.roundedRectangle(...)Plain circular corners. The cheapest to clip.
LiquidGlassShape.squircle(...)Lⁿ squircle — iOS-style continuous curvature.
LiquidGlassShape.continuousRoundedRectangle(...)Apple capsule-style continuous corners. The default; collapses to a clean capsule at full radius.

A shape is the outline and nothing else: all three take cornerRadius (default 50) and clipQuality, and copyWith(...) changes either. The border is no longer part of the shape — it is the style's two lights, below.

Fill#

PropertyDefaultWhat it does
colortransparentBase tint. Usually a low-alpha white or black. The border takes its tint from it too.
blur0Blur of what shows through the glass, as one Gaussian sigma in logical pixels. 0 is no blur.
saturation1.01.0 unchanged, 0.0 grayscale, above 1 more vivid.
shadownullA LiquidGlassShadow contact shadow around the glass. See Shadow.

Refraction#

One model, two numbers: the edge bends what is behind it by refractionIndex over a band refractionWidth wide.

PropertyDefaultWhat it does
refractionIndex1.1How hard the edge bends the content behind it. 1.0 is no bending; the bend builds quickly, so 1.02 is already a clear lens edge and 1.5 a very strong one.
refractionWidth12Width of the bending band, in logical pixels: how far in from the outline the bend reaches.
magnification1.0Zoom of what is seen through the glass. 1.0 is none.
dispersion0Colour fringe in the bending band. Off by default, and at 0 the band costs one backdrop read per pixel. The value is the widest split in logical pixels: 1.3 is a thin fringe, 6.6 a strong one.

The border: two lights#

The rim is two LiquidGlassLights on the style. The specular is the highlight: a crisp band that takes the colour of the backdrop seen through the edge, brightened. The glow is the softer, wider side band that fills the sides the specular leaves dark. Each light draws a pair of opposing arcs on its own axis.

ParameterSpecularGlowWhat it does
thickness510Depth of the band in from the outline, in logical pixels, as given. 0 draws nothing.
sharpness0.5—How solid the band reads across its depth: higher holds it full for longer, lower pulls it tight against the outline.
angle3990The axis of the two arcs, in degrees: 0 is left and right, 90 top and bottom. Absolute — turning one light never turns the other.
spread0.90.5How far the arcs wrap round the outline, 0–1.
intensity11Strength. 0 turns the light off.
oppositeIntensity11The far arc as a multiple of the near one: 0 is one arc only, above 1 the far arc outshines the near.
colornullnullnull takes the picked-up colour. Set, the light is drawn in that colour as given, and its alpha is how much of it replaces the picked-up colour.
Dart
LiquidGlassLens(
  style: const LiquidGlassStyle(
    shape: LiquidGlassShape.squircle(cornerRadius: 36),
    specular: LiquidGlassLight.specular(thickness: 5, angle: 39),
    glow: LiquidGlassLight.glow(angle: 129, intensity: 0.8),
    refractionIndex: 1.02,
    refractionWidth: 24,
    color: Color(0x22FFFFFF),
    blur: 3,
  ),
  child: child,
)

Coming from 4.x#

5.0.0 flattened the style and replaced the border types with the two lights. The common moves:

4.x5.0.0
appearance: LiquidGlassAppearance(color: c, saturation: s, shadow: h)color: c, saturation: s, shadow: h on the style
LiquidGlassBlur(sigmaX: b, sigmaY: b)blur: b on the style
style.copyWith(appearance: style.appearance.copyWith(color: c))style.copyWith(color: c)
refraction: LiquidGlassRefraction(magnification: m, chromaticAberration: c)magnification: m, dispersion: c on the style
distortion / distortionWidth, OpticalRefraction(...)refractionIndex / refractionWidth. The models bend differently, so re-pick the index by eye.
LiquidGlassShape(borderWidth: w)specular: LiquidGlassLight.specular(thickness: w * 5.4) and glow: LiquidGlassLight.glow(thickness: w * 29.4)
lightIntensity / lightDirectionthe specular's intensity / angle (and glow.angle = angle + 90 to keep the glow where it was)
OpticalBorder(lightSpread, borderSolidity, ambientIntensity)specular spread, specular sharpness, glow intensity
ClassicBorder, lightMode, borderColor, refractionMode, diagonalFlip, enableInnerRadiusTransparentremoved

Every parameter#

The tables above are the ones worth learning. The complete list — every field, every default, straight from the source — is generated on the lens API page.

Comments

Comments are GitHub Discussions — reply from either place.