Liquid Glass Easy

The lens and its style

One widget, one style object: shape, appearance, 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, so a look travels as a single value. copyWith(...) and merge(other) are there for theme and override patterns.

Dart
LiquidGlassStyle({
  LiquidGlassShape? shape,          // null → continuous rounded rect
  LiquidGlassAppearance appearance = const LiquidGlassAppearance(),
  LiquidGlassRefraction refraction = const LiquidGlassRefraction(),
  LiquidGlassAdaptivity? adaptivity,
})

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.

All three share cornerRadius, borderWidth, borderColor, lightColor, lightIntensity, lightDirection, borderType and clipQuality.

Appearance#

PropertyDefaultWhat it does
colortransparentBase tint. Usually a low-alpha white or black.
blurLiquidGlassBlur()Blur applied to what shows through the glass.
saturation1.01.0 unchanged, 0.0 grayscale, above 1 more vivid.
enableInnerRadiusTransparentfalseMakes the inner, undistorted region fully transparent.

Refraction#

PropertyDefaultWhat it does
distortion0.1How hard the edge band bends content, 0.01.0.
distortionWidth30Thickness of that band around the perimeter, in px.
magnification1.0Zoom of what is seen through the glass. 1.0 is none.
chromaticAberration0.003Colour-channel separation at the rim. 0.0 disables it.
refractionModeshapeRefractionshapeRefraction follows the outline; radialRefraction bends in a circular pattern.
refractionTypenullSwap the model itself — e.g. OpticalRefraction(refraction:, refractionWidth:, depth:) for a thickness-based lens.

Borders#

The rim is part of the shape, set through borderType. There are two models and they are genuinely different ideas, not two presets.

ModeWhat it is
OpticalBorderDefault. An SDF rim light that falls out of the glass shape: background-tinted highlights, dual-sided speculars, a height profile. The rim colour adapts to whatever is behind the lens.
ClassicBorderDeprecated. Light and shadow sweep the outline by the angle between surface normal and light direction. Stylized, and you control the colours directly — a rim that is drawn rather than derived. Use OpticalBorder.
Dart
// Optical: borderSaturation, ambientIntensity, borderSolidity
shape: LiquidGlassShape.squircle(
  cornerRadius: 36,
  borderType: OpticalBorder(
    borderSaturation: 1.5,
    ambientIntensity: 1.0,
    borderSolidity: 0.0,
  ),
)

// borderWidth, lightIntensity, lightColor and lightDirection live on the
// shape itself, so they apply whichever border type is in use.
shape: LiquidGlassShape.squircle(
  cornerRadius: 36,
  borderWidth: 1.4,
  lightIntensity: 1.0,
  lightColor: Color(0xB2FFFFFF),
)

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.