scale method

BorderSide scale (double t)

Creates a copy of this border side description but with the width scaled by the factor t.

The t argument represents the multiplicand, or the position on the timeline for an interpolation from nothing to this, with 0.0 meaning that the object returned should be the nil variant of this object, 1.0 meaning that no change should be applied, returning this (or something equivalent to this), and other values meaning that the object should be multiplied by t. Negative values are treated like zero.

Since a zero width is normally painted as a hairline width rather than no border at all, the zero factor is special-cased to instead change the style to BorderStyle.none.

Values for t are usually obtained from an Animation<double>, such as an AnimationController.

Implementation

BorderSide scale(double t) {
  assert(t != null);
  return BorderSide(
    color: color,
    width: math.max(0.0, width * t),
    style: t <= 0.0 ? BorderStyle.none : style,
  );
}