lerp static method
Linearly interpolates between two styles.
Implementation
static CodeBlockStyle? lerp(CodeBlockStyle? a, CodeBlockStyle? b, double t) {
if (a == null && b == null) {
return null;
}
if (a == null) {
return t < 0.5 ? null : b;
}
if (b == null) {
return t < 0.5 ? a : null;
}
return CodeBlockStyle(
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
borderColor: Color.lerp(a.borderColor, b.borderColor, t),
borderWidth: lerpDouble(a.borderWidth, b.borderWidth, t),
borderRadius: Radius.lerp(a.borderRadius, b.borderRadius, t),
padding: EdgeInsetsGeometry.lerp(a.padding, b.padding, t),
headerPadding: EdgeInsetsGeometry.lerp(
a.headerPadding,
b.headerPadding,
t,
),
fontFamily: t < 0.5 ? a.fontFamily : b.fontFamily,
fontFamilyPackage: t < 0.5 ? a.fontFamilyPackage : b.fontFamilyPackage,
fontSize: lerpDouble(a.fontSize, b.fontSize, t),
textColor: Color.lerp(a.textColor, b.textColor, t),
showLanguageLabel: t < 0.5 ? a.showLanguageLabel : b.showLanguageLabel,
languageStyle: TextStyle.lerp(a.languageStyle, b.languageStyle, t),
showCopyButton: t < 0.5 ? a.showCopyButton : b.showCopyButton,
copyLabel: t < 0.5 ? a.copyLabel : b.copyLabel,
copiedLabel: t < 0.5 ? a.copiedLabel : b.copiedLabel,
);
}