IndicatorLensOptics class
Optics of the lifted iOS 26/27 tab-bar selection lens.
Pass it as indicatorLens on GlassTabBar.bottom, GlassTabBar.inline,
GlassTabBar.searchable, or GlassTabBar.minimizable to change how the
lens bends what is under it, or use IndicatorLensOptics.disabled to keep
the single-pass glass refraction.
The defaults were read from UIKit: a native UITabBar on the iOS 27.2
simulator, held lifted through XCUITest while its _UILiquidLensView
layer tree was archived and its two displacement maps were rendered over a
position-encoded ramp. The lens warps two things separately:
- Content — the tab items in their selected colour, each magnified on its own centre (GlassTabBar.magnification, 1.16 natively), are drawn inside the lens and displaced inward near the rim (contentDisplacement across contentBevel). The rim band shows a mirrored, compressed copy of what lies further in: an icon or label crossing the edge folds back.
- Backdrop — the bar and the page behind the lens are displaced outward (backdropDisplacement across backdropBevel), so what sits just outside the lens is pulled into its edge.
Both follow the same profile: a sample d points in from the rim moves
by displacement × (1 − √(1 − t²)) with t = 1 − d / bevel, along the
rim normal bent ovalization of the way toward an ellipse's. Samples the
backdrop warp pushes past the lens repeat the lens' edge, as UIKit's
margin-less backdrop capture does, so what sits just outside is smeared
across the rim.
On top, the glass splits red from blue across the outer aberrationBand of the warped image (aberration, fading to nothing at the band's inner edge), which turns that smear and anything crossing the rim into rainbow fringes.
The native lens needs Impeller (ImageFilter.isShaderFilterSupported)
and GlassQuality.premium; elsewhere the indicator keeps its single-pass
refraction.
Lengths are logical pixels.
- Annotations
Constructors
- IndicatorLensOptics({bool enabled = true, double contentDisplacement = -17.5, double contentBevel = 11.2, double backdropDisplacement = 9.0, double backdropBevel = 36.0, double ovalization = 0.5, double aberration = 2.7, double aberrationBand = 14.0})
-
Creates lens optics. Every value defaults to the measured native lens.
const
Properties
- aberration → double
-
How far red and blue are pulled apart at the rim, in opposite
directions along the position's normalised
(y, x): along the rim at the ends and the middle of each side, across it on the diagonals.final - aberrationBand → double
-
Width of the band, measured in from the rim, that shows aberration.
final
- backdropBevel → double
-
Width of the band, measured in from the rim, over which the backdrop is
displaced.
final
- backdropDisplacement → double
-
How far the backdrop is displaced at the rim. Positive values sample
outward, pulling the surroundings into the lens edge.
final
- contentBevel → double
-
Width of the band, measured in from the rim, over which the content is
displaced.
final
- contentDisplacement → double
-
How far the selected content is displaced at the rim. Negative values
sample further in, which folds the rim band back on itself.
final
- enabled → bool
-
Whether the native lens runs at all.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- ovalization → double
-
How far the displacement direction bends from the rim normal toward the
normal of the ellipse inscribed in the lens (
0follows the rim).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{bool? enabled, double? contentDisplacement, double? contentBevel, double? backdropDisplacement, double? backdropBevel, double? ovalization, double? aberration, double? aberrationBand}) → IndicatorLensOptics - Returns a copy with the given values replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- disabled → const IndicatorLensOptics
- No native lens: the indicator keeps its single-pass refraction.
- native → const IndicatorLensOptics
- The measured native lens (the default).