resize method

TransformationData resize(
  1. int? height,
  2. int? width,
  3. Fit? fit,
  4. String? background,
  5. Position? position,
  6. Algorithm? algorithm,
  7. double? dpr,
)

Method for Basic Transformations @param height int (Default: 0) @param width int (Default: 0) @param fit Fit? (Default: cover) @param background String (Default: "000000") @param position Position? (Default: center) @param algorithm Algorithm? (Default: lanczos3) @param DPR double (Default: 1) @return TransformationData.

Implementation

TransformationData resize(
  int? height,
  int? width,
  Fit? fit,
  String? background,
  Position? position,
  Algorithm? algorithm,
  double? dpr,
) {
  // Determine if there are values to add to the dictionary

  var values = <String, String>{};

  if (height != null) {
    values['h'] = height.toString();
  }

  if (width != null) {
    values['w'] = width.toString();
  }

  if (fit != null) {
    values['f'] = fit.value;
  }

  if (background != null && background.isNotEmpty) {
    values['b'] = background;
  }

  if (position != null) {
    values['p'] = position.value;
  }

  if (algorithm != null) {
    values['k'] = algorithm.value;
  }

  if (dpr != null) {
    values['dpr'] = dpr.toString();
  }

  return TransformationData(plugin: 't', name: 'resize', values: values);
}