lerp method

  1. @override
TextSpec lerp(
  1. covariant TextSpec? other,
  2. double t
)
override

Linearly interpolate with another Spec object.

Implementation

@override
TextSpec lerp(TextSpec? other, double t) {
  if (other == null) return this;
  // Define a helper method for snapping

  return TextSpec(
    overflow: lerpSnap(overflow, other.overflow, t),
    strutStyle: lerpStrutStyle(strutStyle, other.strutStyle, t),
    textAlign: lerpSnap(textAlign, other.textAlign, t),
    textScaleFactor: lerpDouble(textScaleFactor, other.textScaleFactor, t),
    maxLines: lerpSnap(maxLines, other.maxLines, t),
    style: lerpTextStyle(style, other.style, t),
    textWidthBasis: lerpSnap(textWidthBasis, other.textWidthBasis, t),
    textHeightBehavior:
        lerpSnap(textHeightBehavior, other.textHeightBehavior, t),
    textDirection: lerpSnap(textDirection, other.textDirection, t),
    softWrap: lerpSnap(softWrap, other.softWrap, t),
    directive: lerpSnap(directive, other.directive, t),
    animated: other.animated ?? animated,
  );
}