applyDeltaTo method
Applies only the fields of this override that differ from baseline onto
base.
baseline is the default surface the override was derived from
(for example GlassThemeSettings.ios27Light or
GlassThemeSettings.classicLight, which is also what
GlassThemeData.simple copies and tweaks). A field that still equals
baseline is treated as "not set by the app" and left to base, so a
dedicated preset such as LiquidGlassSettings.ios27Light or
LiquidGlassSettings.classicTabBar is not overwritten by general surface
defaults it was never meant to inherit.
Fields that differ from baseline are applied exactly as applyTo
would. Consequently an override cannot express "set this field to the
baseline value" — pass explicit settings to the widget for that.
Implementation
LiquidGlassSettings applyDeltaTo(
LiquidGlassSettings base,
GlassThemeSettings baseline,
) {
T? pick<T>(T? value, T? baselineValue) =>
(value != null && value != baselineValue) ? value : null;
return base.copyWith(
visibility: pick(visibility, baseline.visibility),
glassColor: pick(glassColor, baseline.glassColor),
thickness: pick(thickness, baseline.thickness),
blur: pick(blur, baseline.blur),
frost: pick(frost, baseline.frost),
frostOpacity: pick(frostOpacity, baseline.frostOpacity),
frostClamp: pick(frostClamp, baseline.frostClamp),
frostWeight: pick(frostWeight, baseline.frostWeight),
blurWeight: pick(blurWeight, baseline.blurWeight),
chromaticAberration:
pick(chromaticAberration, baseline.chromaticAberration),
lightAngle: pick(lightAngle, baseline.lightAngle),
lightIntensity: pick(lightIntensity, baseline.lightIntensity),
ambientStrength: pick(ambientStrength, baseline.ambientStrength),
fresnelStrength: pick(fresnelStrength, baseline.fresnelStrength),
refractiveIndex: pick(refractiveIndex, baseline.refractiveIndex),
saturation: pick(saturation, baseline.saturation),
specularSharpness: pick(specularSharpness, baseline.specularSharpness),
edgeAbsorption: pick(edgeAbsorption, baseline.edgeAbsorption),
rimShade: pick(rimShade, baseline.rimShade),
rimShadeEnds: pick(rimShadeEnds, baseline.rimShadeEnds),
rimLight: pick(rimLight, baseline.rimLight),
bodyShade: pick(bodyShade, baseline.bodyShade),
lensModel: pick(lensModel, baseline.lensModel),
shadowElevation: pick(shadowElevation, baseline.shadowElevation),
shadow: listEquals(shadow, baseline.shadow) ? null : shadow,
);
}