setResizeMode method

  1. @ControllerProps(NodeProps.kResizeMode)
void setResizeMode(
  1. ImageRenderViewModel renderViewModel,
  2. String resizeMode
)

Implementation

@ControllerProps(NodeProps.kResizeMode)
void setResizeMode(ImageRenderViewModel renderViewModel, String resizeMode) {
  if (resizeMode == 'contain') {
    renderViewModel.fit = BoxFit.contain;
  } else if (resizeMode == 'cover') {
    renderViewModel.fit = BoxFit.cover;
  } else if (resizeMode == 'center') {
    renderViewModel.alignment = Alignment.center;
  } else if (resizeMode == 'origin') {
    renderViewModel.alignment = Alignment.topLeft;
  } else if (resizeMode == 'repeat') {
    renderViewModel.repeat = ImageRepeat.repeat;
  } else {
    renderViewModel.fit = BoxFit.cover;
  }
}