ResponsiveValue<T>.from constructor

ResponsiveValue<T>.from({
  1. bool allowNull = false,
  2. T? large,
  3. T? medium,
  4. T? small,
  5. T? xsmall,
  6. T? fallback,
})

Implementation

factory ResponsiveValue.from(
    // T? xlarge,
    {
  bool allowNull = false,
  T? large,
  T? medium,
  T? small,
  T? xsmall,
  T? fallback,
}) {
  T? xlargeValue;
  T? largeValue;
  T? mediumValue;
  T? smallValue;
  T? xsmallValue;

  if (xsmall != null) {
    xsmallValue = xsmall;
    smallValue = xsmall;
    mediumValue = xsmall;
    largeValue = xsmall;
    xlargeValue = xsmall;
  }

  if (small != null) {
    smallValue = small;
    mediumValue = small;
    largeValue = small;
    xlargeValue = small;
  }

  if (medium != null) {
    mediumValue = medium;
    largeValue = medium;
    xlargeValue = medium;
  }

  if (large != null) {
    largeValue = large;
    xlargeValue = large;
  }

  return ResponsiveValue(
    allowNull: allowNull,
    xsmall: xsmallValue,
    small: smallValue,
    medium: mediumValue,
    large: largeValue,
    xlarge: xlargeValue,
    fallback: fallback,
  );
}