scaledPadding static method

EdgeInsetsGeometry scaledPadding(
  1. EdgeInsetsGeometry geometry1x,
  2. EdgeInsetsGeometry geometry2x,
  3. EdgeInsetsGeometry geometry3x,
  4. double textScaleFactor,
)

Returns an interpolated value based on the textScaleFactor parameter:

  • 0 - 1 geometry1x
  • 1 - 2 lerp(geometry1x, geometry2x, textScaleFactor - 1)
  • 2 - 3 lerp(geometry2x, geometry3x, textScaleFactor - 2)
  • otherwise geometry3x

A convenience method for subclasses.

Implementation

static EdgeInsetsGeometry scaledPadding(
  EdgeInsetsGeometry geometry1x,
  EdgeInsetsGeometry geometry2x,
  EdgeInsetsGeometry geometry3x,
  double textScaleFactor,
) {
  assert(geometry1x != null);
  assert(geometry2x != null);
  assert(geometry3x != null);
  assert(textScaleFactor != null);

  if (textScaleFactor <= 1) {
    return geometry1x;
  } else if (textScaleFactor >= 3) {
    return geometry3x;
  } else if (textScaleFactor <= 2) {
    return EdgeInsetsGeometry.lerp(
        geometry1x, geometry2x, textScaleFactor - 1)!;
  }
  return EdgeInsetsGeometry.lerp(
      geometry2x, geometry3x, textScaleFactor - 2)!;
}