Liquid Glass Easy

دوال الأشكال

الدوال الحرة التي تستخدمها المُصيّرات لقص مسار العدسة ورسمه. مُصدَّرة لأن نصفي المكتبة يحتاجانها، ونادراً ما تستدعيها بنفسك.

function

liquidGlassClip#

Wraps child in the clip that matches shape's outline, honoring its LiquidGlassShape.clipQuality: a circular ClipRRect, a shader-matched squircle ClipPath, or an Apple capsule-style continuous ClipPath. Used by the renderers so the clipped blur/child silhouette agrees with the SDF the shader draws.

التوقيع

liquidGlassClip({ required LiquidGlassShape shape, required Widget child, Offset shapeScale = const Offset(1, 1), })
المعاملالنوعالافتراضيالوصف
shapeمطلوبLiquidGlassShape
childمطلوبWidget
shapeScaleOffsetconst Offset(1, 1)

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

function

liquidGlassClipCornerRadius#

The corner radius used to clip a lens to its outline.

التوقيع

liquidGlassClipCornerRadius(LiquidGlassShape shape)
المعاملالنوعالافتراضيالوصف
shapeLiquidGlassShape

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

function

liquidGlassCornerStyle#

The shader corner-style selector (u_cornerStyle), derived from LiquidGlassShape.cornerStyle:

التوقيع

liquidGlassCornerStyle(LiquidGlassShape shape)
المعاملالنوعالافتراضيالوصف
shapeLiquidGlassShape

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

function

liquidGlassUsesRoundedClip#

Whether the shape uses a rounded clip for its blur-backdrop and child clips. Every LiquidGlassShape is a rounded-rectangle family shape, so this is always true — kept as a named predicate for the renderers' call sites.

التوقيع

liquidGlassUsesRoundedClip(LiquidGlassShape shape)
المعاملالنوعالافتراضيالوصف
shapeLiquidGlassShape

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

function

liquidGlassCornerSegments#

Tessellation density for a corner of on-screen reach — shared by both curved corner styles. A corner spans 2 × this many straight segments.

reach is the corner's actual extent — the continuous curve's r · (1 + slack), the squircle's zone — NOT its radius. A stretched corner covers more ground per step than a round one of the same radius, and keying this on r alone lets an extreme aspect ratio slip past the budget (measured: 600×24 at r 12 strayed 0.052 px).

Inverts the sagitta law for the clip's error budget (0.05 logical px), so a small pill is not tessellated to the same density as a full-screen card. Floored at 3 so even a hairline radius keeps a curve, and capped at 40.

التوقيع

liquidGlassCornerSegments(double reach)
المعاملالنوعالافتراضيالوصف
reachdouble

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

function

liquidGlassSquirclePath#

The continuous-curvature (squircle) outline — the SAME L^n superellipse the shader draws. zone and n are derived exactly like continuousCornerParams in liquid_glass_common.glsl, so the clip lines up with the refraction.

التوقيع

liquidGlassSquirclePath(Size size, double r, double smoothing, { int? seg, double renderScale = 1.0, })
المعاملالنوعالافتراضيالوصف
sizeSize
rdouble
smoothingdouble
segint?
renderScaledouble1.0

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

function

liquidGlassContinuousRoundedRectPath#

The capsule-style continuous rounded-rectangle outline: each corner is a p-norm ball whose box is stretched along whichever edge has room, with an exponent that rises with that same room. The stretch is what makes the corner read as continuous — the curve leaves the edge at r · (1 + 0.2893) with zero tangent and curvature, instead of turning in at r.

This is the Dart twin of the shader's continuousRoundedRect* SDF, so the LiquidGlassClipQuality.continuous clip lines up with the refraction.

Both the reach and the exponent ramp with each edge's slack, so a square at full radius collapses to a clean circle and a capsule keeps a circular end cap while its long flank stays smoothed.

التوقيع

liquidGlassContinuousRoundedRectPath(Size size, double r, { int? seg, double renderScale = 1.0, })
المعاملالنوعالافتراضيالوصف
sizeSize
rdouble
segint?
renderScaledouble1.0

معرَّف في lib/src/widgets/utils/liquid_glass_shape.dart

التعليقات

التعليقات هي مناقشات GitHub — يمكنك الرد من أيٍّ من المكانين.