Liquid Glass Easy

The lens and its style

One widget and the flat descriptor that decides how it looks: its outline, the two lights of its border, its fill and its refraction.

class

LiquidGlassLens#

Extends StatefulWidgetGuide: The lens and its style →

A liquid-glass lens you can place anywhere in the widget tree.

Unlike the children: slot of LiquidGlassView, this lens is layout-driven: it has no position or size parameters — it is exactly where layout puts it and exactly as big as its constraints/child make it (wrap it in a SizedBox to give it explicit dimensions).

Render modes (resolved automatically)

  • Impeller (ImageFilter.isShaderFilterSupported): the lens refracts the live backdrop — whatever your app painted behind it. No LiquidGlassView and no background widget needed at all; drop it over any UI and it works.
  • Skia / Web with an ancestor LiquidGlassView that has a backgroundWidget: the lens refracts the view's captured background, wherever the lens sits inside the view's child.
  • Skia / Web without a view (or without a background): refraction is impossible, so the lens degrades to a frosted look — backdrop blur + tint + border, no refraction — and logs a one-time debug warning.

The mode is an implementation detail: the widget tree you write is identical in all three cases.

Lenses inside scrollables (Impeller)

Android's stretch overscroll effect isolates the scrollable's content into its own compositing layer while the stretch plays. A BackdropFilter-based lens inside that layer can no longer see the real backdrop and renders black at both scroll edges. Disable the overscroll indicator for scrollables that contain lenses:

Dart
ScrollConfiguration(
  behavior: const MaterialScrollBehavior().copyWith(overscroll: false),
  child: ListView(children: [ ...LiquidGlassLens(...)... ]),
)
Dart
SizedBox(
  width: 220,
  height: 120,
  child: LiquidGlassLens(
    style: const LiquidGlassStyle(
      shape: LiquidGlassShape.roundedRectangle(cornerRadius: 36),
    ),
    child: const Center(child: Text('glass')),
  ),
)

Constructors

const LiquidGlassLens({ super.key, this.style = const LiquidGlassStyle(), this.visibility = true, this.useImpellerBackdrop, this.touch, this.deform, this.restSize, this.honorBackdropAlpha = false, this.child })
ParameterTypeDefaultDescription
keyKey?—
styleLiquidGlassStyleconst LiquidGlassStyle()The lens's look — its LiquidGlassShape (corners + border), its appearance (tint, blur, saturation) and its refraction (how it bends the content behind it) — bundled as one LiquidGlassStyle. A null style.shape falls back to a default continuous rounded rectangle.
visibilitybooltrueWhether the lens is shown. When false the glass is disabled (no backdrop cost) and the child is removed, so a hidden lens leaves nothing behind. The change is instant — there is no built-in show/hide animation; wrap the lens yourself to animate it.
useImpellerBackdropbool?—Override for the Impeller fast-path detection, like LiquidGlassView.useImpellerBackdrop. When null, inherits the ancestor view's setting, falling back to ImageFilter.isShaderFilterSupported.
touchLiquidGlassTouch?—How the lens answers a finger — see LiquidGlassTouch. With a LiquidGlassTouch.flex the lens deforms under touch: press it and it compresses, drag it and it elongates along the pull, pinches in the cross axis and leans after your finger, then springs back with a wobble. The lens itself does not move; only its shape and its content deform. null (the default) disables the behaviour entirely — no gesture listener, no ticker, nothing added to the tree. Honored inside a LiquidGlassBlender: the merged metaball silhouette picks a member's deformation up from its resized box. Only LiquidGlassFlexAdvanced.refractionBoost does not survive the merge: a merged member has no refraction band of its own to deepen.
deformLiquidGlassFlexDeform?—A deformation supplied from outside, for a host that computes the glass's shape itself instead of letting a finger do it. With touch the lens owns the whole gesture: it listens for pointers and runs its own spring driver. Some hosts cannot work that way — a slider thumb or a nav pill is deformed by where it is being carried, which only the host knows. Passing a deform here skips the listener and the driver entirely and renders exactly what is given. The lens's own box must ALREADY be the deformed size; restSize is what the deformation is measured against, and the shape is evaluated there and stretched by deformed ÷ rest — so a capsule's caps go elliptical instead of being re-rounded at each new size. Both this and restSize must be set for the external path to engage; either one alone is ignored. Takes precedence over touch.
restSizeSize?—The undeformed size deform is measured against. See deform.
honorBackdropAlphaboolfalseWhether the shader folds the captured backdrop's alpha into its own coverage — Skia capture path only, ignored on Impeller. false (the default) treats the capture as opaque, which is right for a view whose background is a full page. Set it when the captured background carries authored transparency that must pass through the glass, such as a slider's track, where opaque treatment renders the lens's overhang as a dark body.
childWidget?—Content rendered on top of the glass, clipped to the lens shape.

Declared in lib/src/widgets/lens/liquid_glass_lens.dart

class

LiquidGlassLite#

Extends StatelessWidgetGuide: Lite glass →

Glass without the shader: a frosted surface with the lens' own rim light, drawn from plain canvas geometry.

A LiquidGlassLens gets its look from the glass shader: every pixel measures its own distance to the shape's SDF, reads the background under it, bends it, and lights itself. That is what makes the rim feel like an optical consequence of the glass — and it is also why it costs a FragmentProgram, a program warm-up, and (on Impeller) a slot in the lens budget.

This is the light version of that. It gives up refraction, which is the half that needs a shader, and keeps the half that does not: the frost, the tint, and the rim.

The rim is a lens' specular, evaluated on the Dart side: the outline is sampled into a ring of points, each point's outward normal is run through the shader's own formulas — the same ramp across the edge, the same pair of arcs on the light's axis — and the result is a few drawVertices calls per light. blur is the glass itself; the rim is its edge. No shader asset, no FragmentProgram, nothing to warm up.

It takes the ordinary LiquidGlassShape and the lens' two lights: the specular, and the glow under it, each drawing the same band here as it does on a lens. Neither light reads the backdrop, so a glow costs nothing but its own mesh. The silhouette comes from the same outline a lens clips to, so all three corner styles — circular, squircle, and the continuous capsule corner — are reproduced exactly.

A painted rim

The rim is painted last, over the frost, the color and the child, and reads nothing back. Each light is blended into the finished surface with overlay, so it brightens whatever it lies over and keeps that colour: red where the surface is red, blue where it is blue. A plain white floor is screened over the blend so the rim still shows over black, where overlay has nothing to lift. A light's own color is multiplied in after that, so a grey light is a grey rim.

Because it reads nothing, the rim holds up wherever a backdrop read does not: through page transitions, under the overscroll stretch, inside any layer that moves.

There is no refraction — no edge bend. magnification is the flat-slab half only; the rim itself does not shift with the content behind it the way glass does.

It is an inner border

The rim is clipped to the outline, like a lens clips its shader, so it is drawn strictly INSIDE the box — brightest against the edge and falling away inward, never hanging past it. Give the widget the size of the surface the border belongs to, not a box around it.

When to reach for it

For a surface that is not a lens — a card, a list row, a sheet, a focus ring — and for the many-of-them cases where real lenses would be too expensive: long lists, low-end devices, the web.

The frost is its only backdrop read. blur: 0 at a magnification of 1 drops that read too, and the surface reads nothing at all.

Dart
LiquidGlassLite(
  shape: const LiquidGlassShape(
    cornerRadius: 22,
  ),
  specular: const LiquidGlassLight.specular(angle: 90),
  child: const Text('on the glass'),
)

Constructors

const LiquidGlassLite({ super.key, this.shape = const LiquidGlassShape(), this.specular, this.glow, this.borderAlpha = 1.0, this.blur = 3.0, this.magnification = 1.0, this.color, this.shapeScale = const Offset(1.0, 1.0), this.child, })
ParameterTypeDefaultDescription
keyKey?—
shapeLiquidGlassShapeconst LiquidGlassShape()The outline to draw, read exactly as a lens reads it.
specularLiquidGlassLight?—The rim's highlight; null is LiquidGlassLight.specular(). It is read as a lens reads its specular: thickness, sharpness, angle, spread, intensity and colour.
glowLiquidGlassLight?—The rim's soft side light, drawn under the specular and read as a lens reads its glow: thickness, angle, spread, intensity and colour. null draws none.
borderAlphadouble1.0A global multiplier on the rim's opacity, for fading it in and out. The lens uses the same knob for its own show/hide animation.
blurdouble3.0How much the surface frosts what is behind it, inside its own outline. This is the glass itself rather than its edge: a backdrop blur clipped to the shape, painted under child, the same thing a lens' own blur does. A Gaussian sigma; 3 by default, and 0 is a bare rim over whatever is already there. It costs one backdrop read, the surface's only one, so a screen with many of them wants 0 here.
magnificationdouble1.0How much the surface magnifies what is behind it: the backdrop scaled about the shape's centre, evenly, across the whole surface. This is the flat-slab half of a lens' refraction — the content inside the outline stops lining up with the content outside it. It rides in the blur's own filter, so it is free when blur is on. 1.0 is flat.
colorColor?—The glass's own tint, LiquidGlassStyle.color's counterpart: a flat fill of the shape between the frost and child. The rim is painted over it and blends into it. null, or fully transparent, paints nothing.
shapeScaleOffsetconst Offset(1.0, 1.0)The deformation applied to the outline, matching a lens' shape scale: the shape is built at rest size and stretched, so a squeezed circle becomes an ellipse instead of keeping a fixed corner radius.
childWidget?—The content the rim is drawn over: the rim is painted on top of it. When null the widget expands to its constraints and draws the rim alone.

Declared in lib/src/widgets/components/liquid_glass_lite.dart

The look of a liquid-glass surface, bundled into one reusable descriptor: its shape, the two lights of its border (specular and glow), its fill (color, blur, saturation, shadow) and how it bends the content behind it (refractionIndex, refractionWidth, magnification, dispersion).

This is the single styling vocabulary shared across the library — LiquidGlassLens and the components (buttons, bars, the nav pill, …) all describe their glass with the same object. Change one facet with copyWith:

Non-refracting consumers — e.g. the static (non-glass) selection pill or the frosted fallback — read the subset they can render and simply ignore the refraction fields.

Dart
const LiquidGlassStyle(
  shape: LiquidGlassShape.continuousRoundedRectangle(cornerRadius: 24),
  specular: LiquidGlassLight.specular(thickness: 5.4, angle: 39),
  glow: LiquidGlassLight.glow(angle: 129),
  refractionIndex: 1.02,
  refractionWidth: 24,
  color: Color(0x22FFFFFF),
  blur: 3,
);

Constructors

const LiquidGlassStyle({ this.shape, this.specular, this.glow, this.refractionIndex = 1.1, this.refractionWidth = 12.0, this.magnification = 1.0, this.dispersion = 0, this.saturation = 1.0, this.blur = 0.0, this.color = const Color(0x00000000), this.shadow, this.adaptivity, this.liteGlass = false, })
ParameterTypeDefaultDescription
shapeLiquidGlassShape?—The outline of the surface. When null, the consumer picks a sensible default (e.g. the nav pill falls back to a height-tracking capsule), so a style can describe the material without pinning the shape.
specularLiquidGlassLight?—The border's highlight: the backdrop seen through the edge, brightened along the light's axis. When null, the consumer's own default is used (LiquidGlassLight.specular() on a plain lens).
glowLiquidGlassLight?—The border's soft side light: a wider, gentler band in the specular's picked-up colour. When null, the consumer's own default is used (no glow on a plain lens, which the shader then skips).
refractionIndexdouble1.1How hard the edge bends the content behind it. 1.0 is no bending, 1.02 a clear lens edge and 1.5 a very strong one.
refractionWidthdouble12.0Width of the bending band along the edge, in logical pixels: how far in from the outline the bend reaches. How strong it is comes from refractionIndex.
magnificationdouble1.0Magnification of the content seen through the glass (1.0 = none).
dispersiondouble0Colour fringe in the bending band: red and blue are read a little either side of green, by an offset that grows with the backdrop's brightness. Strongest on the outline, gone at the band's inner end. - 0.0 — Default: no fringe, and one backdrop read per pixel where any other value costs extra reads in the bending band. The value is the widest split, in logical pixels, reached on the outline over the brightest backdrop. Below about 0.66 it reads as off. - 1.3 — A thin fringe. - 6.6 — Strong. Recommended range: 0.0 to 13.0.
saturationdouble1.0Color saturation of the output (1.0 = unchanged, 0.0 = grayscale).
blurdouble0.0Blur applied to the content beneath the glass, as a Gaussian sigma in logical pixels. 0 (the default) is no blur.
colorColorconst Color(0x00000000)Base color tint of the glass (often semi-transparent).
shadowLiquidGlassShadow?—Contact shadow around the glass — the soft dark band that hugs its rim and pools underneath, so the glass reads as sitting in the page rather than floating on it. null (the default) draws none. Honored by LiquidGlassLens: the lens wraps itself in the LiquidGlassShadow this describes (its child is ignored), with the ring's corner defaulting to the lens shape's own radius. The wrap lives inside the flex deformation's box, so on a lens given a touch the ring swells, leans and springs back with the body instead of staying frozen on the rest silhouette. Its visible flag composes with the lens's own visibility. Not supported inside a LiquidGlassBlender: a merged metaball silhouette has no single ring to cast.
adaptivityLiquidGlassAdaptivity?—iOS-style adaptivity: glass tint + content color flip between two palettes based on the background behind the lens. null (default) disables the feature entirely. Honored by LiquidGlassLens; while active, its glass color overrides color.
liteGlassboolfalseDraw this surface as LiquidGlassLite — frost, tint and a painted rim, no shader and no refraction — whatever engine the app is on. false (the default) leaves the choice to the engine switches on LiquidGlassEngine.

Methods

SignatureDescription
LiquidGlassStyle copyWith({ LiquidGlassShape? shape, LiquidGlassLight? spec…Returns a copy with the given fields replaced. A null argument keeps the current value, so shape, specular, glow, shadow and adaptivity cannot be cleared here.
LiquidGlassStyle merge(LiquidGlassStyle? other)Overlays other on top of this style: other's material (color, blur, saturation, shadow) and refraction fields replace this one's, and its shape, specular, glow and adaptivity win when set (falling back to this style's when null); liteGlass is on when either style has it on. Returns this style unchanged when other is null. Useful for a base/theme style with per-surface overrides.

Declared in lib/src/widgets/liquid_glass_style.dart

The outline of a liquid-glass surface: its corner curve and radius.

One concrete class: the corner curve is chosen by cornerStyle (or one of the LiquidGlassShape.roundedRectangle / LiquidGlassShape.squircle / LiquidGlassShape.continuousRoundedRectangle convenience constructors). The border lives on the style: see LiquidGlassStyle.specular and LiquidGlassStyle.glow.

Constructors

const LiquidGlassShape({ this.cornerStyle = LiquidGlassCornerStyle.continuousRoundedRectangle, this.cornerRadius = 50.0, this.clipQuality = LiquidGlassClipQuality.roundedRectangle, })
ParameterTypeDefaultDescription
cornerStyleLiquidGlassCornerStyleLiquidGlassCornerStyle.continuousRoundedRectangleThe corner curve. See LiquidGlassCornerStyle.
cornerRadiusdouble50.0The corner radius in logical pixels.
clipQualityLiquidGlassClipQualityLiquidGlassClipQuality.roundedRectangleWhether the lens is clipped with the cheap circular rounded rectangle (ClipRRect) or an exact ClipPath matching this shape's shader corner. See LiquidGlassClipQuality. Defaults to LiquidGlassClipQuality.roundedRectangle.
const LiquidGlassShape.roundedRectangle({ double cornerRadius = 50.0, LiquidGlassClipQuality clipQuality = LiquidGlassClipQuality.roundedRectangle, })

A plain circular rounded rectangle (LiquidGlassCornerStyle.roundedRectangle). The cheapest style.

ParameterTypeDefaultDescription
cornerRadiusdouble50.0The corner radius in logical pixels.
clipQualityLiquidGlassClipQualityLiquidGlassClipQuality.roundedRectangleWhether the lens is clipped with the cheap circular rounded rectangle (ClipRRect) or an exact ClipPath matching this shape's shader corner. See LiquidGlassClipQuality. Defaults to LiquidGlassClipQuality.roundedRectangle.
const LiquidGlassShape.squircle({ double cornerRadius = 50.0, LiquidGlassClipQuality clipQuality = LiquidGlassClipQuality.roundedRectangle, })

An L^n squircle rounded rectangle (LiquidGlassCornerStyle.squircle) — iOS-style continuous-curvature corners.

ParameterTypeDefaultDescription
cornerRadiusdouble50.0The corner radius in logical pixels.
clipQualityLiquidGlassClipQualityLiquidGlassClipQuality.roundedRectangleWhether the lens is clipped with the cheap circular rounded rectangle (ClipRRect) or an exact ClipPath matching this shape's shader corner. See LiquidGlassClipQuality. Defaults to LiquidGlassClipQuality.roundedRectangle.
const LiquidGlassShape.continuousRoundedRectangle({ double cornerRadius = 50.0, LiquidGlassClipQuality clipQuality = LiquidGlassClipQuality.roundedRectangle, })

An Apple capsule-style continuous rounded rectangle (LiquidGlassCornerStyle.continuousRoundedRectangle).

ParameterTypeDefaultDescription
cornerRadiusdouble50.0The corner radius in logical pixels.
clipQualityLiquidGlassClipQualityLiquidGlassClipQuality.roundedRectangleWhether the lens is clipped with the cheap circular rounded rectangle (ClipRRect) or an exact ClipPath matching this shape's shader corner. See LiquidGlassClipQuality. Defaults to LiquidGlassClipQuality.roundedRectangle.

Methods

SignatureDescription
LiquidGlassShape copyWith({ LiquidGlassCornerStyle? cornerStyle, double? co…A copy with the given fields replaced.

Declared in lib/src/widgets/utils/liquid_glass_shape.dart

One light on a glass border: a band along the outline, lit as a pair of opposing arcs.

A LiquidGlassStyle carries two of them: specular, the bright highlight, and glow, the softer band that fills the sides the specular leaves dark.

Dart
LiquidGlassStyle(
  specular: LiquidGlassLight.specular(
      thickness: 5, sharpness: 0.5, angle: 39, spread: 0.9, intensity: 1),
  glow: LiquidGlassLight.glow(
      thickness: 10, angle: 90, spread: 0.5, intensity: 1),
)

Constructors

const LiquidGlassLight.specular({ this.thickness = 5.0, this.sharpness = 0.5, this.angle = 39.0, this.spread = 0.9, this.intensity = 1.0, this.oppositeIntensity = 1.0, this.color, })

The highlight: a thin, crisp band on the 39° axis, wrapping wide.

ParameterTypeDefaultDescription
thicknessdouble5.0How deep the light's band reaches in from the outline, in logical pixels: the value is the band's depth as given, with no scaling. 0 draws nothing. Defaults: 5 for a specular, 10 for a glow.
sharpnessdouble0.5How solid the specular reads across its depth. Not used by a glow. The band is a ramp that is strongest on the outline and falls away inward. Sharpness slides that ramp: higher values hold the band at full for longer before it falls, so it reads as a solid line with a soft tail; lower values pull it tight against the outline. - 0.0 — Barely there: a faint hairline. - 0.5 — Default: a crisp, thin band. - 0.6 — The plain ramp, full exactly on the outline. - 1.0 — Solid over the first 40% of the depth, then falls. Recommended range: 0.0 to 1.0.
angledouble39.0The axis the light sits on, in degrees. The light draws two arcs, one on each end of this axis: - 0 — the left and right of the outline. - 39 — Default for a specular: a diagonal between the two. - 90 — Default for a glow: the top and bottom.
spreaddouble0.9How far the arcs wrap around the outline. - 0.0 — Tight arcs on the light axis only. - 0.5 — Moderate wrap. - 1.0 — Broad arcs that wrap almost all the way around. Recommended range: 0.0 to 1.0.
intensitydouble1.0How strong the light is. 0.0 turns it off. Recommended range: 0.0 to 3.0.
oppositeIntensitydouble1.0How strong the arc on the far end of the light's axis is, as a multiple of the near arc. - 0.0 — One arc only: the far side stays dark. - 1.0 — Default: both arcs equally strong. - Above 1.0 — The far arc outshines the near one. Recommended range: 0.0 to 2.0.
colorColor?—The light's own colour, or null for the colour the glass picks up. When null (the default) the light takes the colour of the backdrop seen through the edge, brightened — a specular and a glow alike. Give it white for a white light. When set, the light is drawn in this colour as given; its alpha is how much of it replaces the picked-up colour.
const LiquidGlassLight.glow({ this.thickness = 10.0, this.angle = 90.0, this.spread = 0.5, this.intensity = 1.0, this.oppositeIntensity = 1.0, this.color, })

The soft side light: a wider, gentler band on the 90° axis.

ParameterTypeDefaultDescription
thicknessdouble10.0How deep the light's band reaches in from the outline, in logical pixels: the value is the band's depth as given, with no scaling. 0 draws nothing. Defaults: 5 for a specular, 10 for a glow.
angledouble90.0The axis the light sits on, in degrees. The light draws two arcs, one on each end of this axis: - 0 — the left and right of the outline. - 39 — Default for a specular: a diagonal between the two. - 90 — Default for a glow: the top and bottom.
spreaddouble0.5How far the arcs wrap around the outline. - 0.0 — Tight arcs on the light axis only. - 0.5 — Moderate wrap. - 1.0 — Broad arcs that wrap almost all the way around. Recommended range: 0.0 to 1.0.
intensitydouble1.0How strong the light is. 0.0 turns it off. Recommended range: 0.0 to 3.0.
oppositeIntensitydouble1.0How strong the arc on the far end of the light's axis is, as a multiple of the near arc. - 0.0 — One arc only: the far side stays dark. - 1.0 — Default: both arcs equally strong. - Above 1.0 — The far arc outshines the near one. Recommended range: 0.0 to 2.0.
colorColor?—The light's own colour, or null for the colour the glass picks up. When null (the default) the light takes the colour of the backdrop seen through the edge, brightened — a specular and a glow alike. Give it white for a white light. When set, the light is drawn in this colour as given; its alpha is how much of it replaces the picked-up colour.

Methods

SignatureDescription
LiquidGlassLight copyWith({ double? thickness, double? sharpness, double? a…A copy with the given fields replaced. color cannot be cleared here; build a new light for that.

Static members

SignatureDescription
LiquidGlassLight lerp( LiquidGlassLight a, LiquidGlassLight b, double t)Linearly interpolates between two lights. A null colour fades in from, or out to, the other light's colour at zero alpha, which draws the same as null.

Declared in lib/src/widgets/utils/liquid_glass_light.dart

class

LiquidGlassShadow#

Extends StatelessWidgetGuide: Shadow →

The contact shadow of a glass pill: a soft dark band that hugs the rim and pools underneath, so the glass reads as sitting in the surface rather than floating flat on it.

Wrap the lens, don't go inside it

This is a parent of the glass, not its content:

That placement is the whole point. A lens clips its own child to its outline, so a shadow passed as content can only ever darken the inside — the half that pools below the pill would be cut away, which is the half that actually reads as contact. As a parent it is unclipped, and free to spill past the edge.

It paints behind what it wraps (CustomPaint.painter, before the child), so the glass sits over its own shadow. That is also what keeps a rest state honest: a solid pill drawn over the glass covers the shadow with it, instead of wearing a dark band it should never have.

It never touches what it wraps, so it composes with any lens.

The shape

The shadow is cast by a ring, not by the pill itself: an outer capsule pushed out by 1 px horizontally and blur/2 vertically, minus an inner capsule pulled in by blur/2 vertically. Only a band straddling the rim casts anything, so the middle of the glass stays clear.

That ring is then displaced downward by offset (blur + 2 by default) and blurred. The upper arc lands just inside the top rim; the lower arc lands entirely below the pill. One ring gives both the inner rim contact and the drop beneath.

It composites with BlendMode.multiply, so it darkens whatever is under it — the glass on the inside, the page on the outside — instead of laying flat grey over both.

Keeping it out of the glass

insideGlass decides whether the part of the ring that falls under the outline is drawn at all. true (the default) is the contact look above: the upper arc darkens the inside of the rim. false clips the ring to the outside of the outline and paints it over the glass instead of behind it — visually the same drop beneath, but a lens's backdrop sample never contains it, so a refracting rim cannot pull it into the interior as a dark inner band.

Under a deformed lens

A squashed or stretched lens keeps its authored corner radius and stretches the whole outline (the shader's u_shapeScale), so its caps go elliptical rather than re-rounding. Pass the same scale the lens is drawn with and the ring follows that ellipse; leave it at (1, 1) and the ring is a plain capsule.

Dart
LiquidGlassShadow(
  child: LiquidGlassLens(...),
)

Constructors

const LiquidGlassShadow({ super.key, this.blur = 3.5, this.opacity = 0.2, this.color = Colors.black, this.offset, this.cornerRadius, this.scale = const Offset(1, 1), this.inset = 0, this.visible = true, this.insideGlass = true, this.child, })
ParameterTypeDefaultDescription
keyKey?—
blurdouble3.5Blur radius of the shadow, and the vertical thickness of the ring that casts it.
opacitydouble0.2Shadow opacity.
colorColorColors.blackShadow color before opacity.
offsetOffset?—Downward displacement of the ring. null uses blur + 2, which is what puts the upper arc inside the rim and the lower arc below the pill.
cornerRadiusdouble?—The pill's rest corner radius. null makes it a capsule (half the shorter side of the undeformed box).
scaleOffsetconst Offset(1, 1)The lens's outline stretch — deformed size ÷ rest size. Pass the lens's own value so the ring tracks an elliptical cap; (1, 1) for an undeformed lens.
insetdouble0How far inside the glass the shadow's own pill sits, in logical pixels on every side. 0 (the default) casts from a pill the same size as the lens, so the blurred halo reaches a little past its rim. Raise it to tuck the shadow in — the glass then overhangs its own shadow, which reads as a thinner, tighter contact on a small control where a full-size halo looks like a glow.
visiblebooltrueWhether the shadow is drawn at all. false paints nothing and leaves child untouched, so it can be toggled without changing the widget tree's shape.
insideGlassbooltrueWhether the shadow is drawn under the glass outline. true (the default) paints the whole ring behind the glass, so its upper arc darkens the inside of the rim as contact. false keeps only what falls outside the outline and paints it over the glass, so the lens's backdrop sample never carries the shadow and the refraction band has nothing dark to pull inward. The outline is a rounded rectangle at the lens's corner radius, so a continuous corner is matched to within its own curvature difference.
childWidget?—The glass this shadow belongs to. Sized by the parent; the shadow takes whatever box the child gets.

Declared in lib/src/widgets/components/liquid_glass_shadow.dart

enum

LiquidGlassCornerStyle#

The corner curve of a LiquidGlassShape.

Selects which corner SDF the shader draws and which exact clip path the renderers use. The single axis of variation between the old RoundedRectangleShape / SquircleShape / ContinuousRoundedRectangleShape classes, now an explicit value.

Values

ValueDescription
roundedRectanglePlain circular rounded rectangle — corners are circular arcs of cornerRadius. The cheapest style.
squircleL^n squircle — the corners use the superellipse (L^n-norm) continuous-curvature profile, full iOS-style smoothing. The shader draws the matching squircle* SDF.
continuousRoundedRectangleApple capsule-style continuous rounded rectangle — each corner is an exact circle "belly" plus a tuned G2 shoulder onto each flat edge. The shader draws the matching continuousRoundedRect* SDF; at full radius it degrades to a clean capsule. The default corner style.

Declared in lib/src/widgets/utils/liquid_glass_shape.dart

enum

LiquidGlassClipQuality#

How a lens is clipped to its outline. Every LiquidGlassShape carries its own LiquidGlassShape.clipQuality.

Values

ValueDescription
roundedRectangleCheapest: a plain circular rounded-rectangle clip (ClipRRect). The historic default. Its silhouette is a circular corner even when the shader draws a squircle/continuous corner, so for those shapes the clipped child/blur edge may not perfectly hug the refraction.
exactAn exact ClipPath that matches this shape's shader corner: the squircle L^n curve for LiquidGlassCornerStyle.squircle, the Apple capsule-style curve for LiquidGlassCornerStyle.continuous, and a circular rounded rect for LiquidGlassCornerStyle.circular. Slightly pricier (adds a save layer) but the clipped silhouette lines up exactly with the refraction.

Declared in lib/src/widgets/utils/liquid_glass_shape.dart

Comments

Comments are GitHub Discussions — reply from either place.