setCapInsets method

  1. @ControllerProps(NodeProps.kCapInsets)
void setCapInsets(
  1. ImageRenderViewModel renderViewModel,
  2. VoltronMap? capInsetsMap
)

Implementation

@ControllerProps(NodeProps.kCapInsets)
void setCapInsets(ImageRenderViewModel renderViewModel, VoltronMap? capInsetsMap) {
  if (capInsetsMap != null) {
    renderViewModel.capInsets = CapInsets(
      left: capInsetsMap.get<double>('left') ?? capInsetsMap.get<int>('left')?.toDouble() ?? 0.0,
      top: capInsetsMap.get<double>('top') ?? capInsetsMap.get<int>('top')?.toDouble() ?? 0.0,
      right:
          capInsetsMap.get<double>('right') ?? capInsetsMap.get<int>('right')?.toDouble() ?? 0.0,
      bottom: capInsetsMap.get<double>('bottom') ??
          capInsetsMap.get<int>('bottom')?.toDouble() ??
          0.0,
    );
  }
}