updateFilterEffects method

void updateFilterEffects(
  1. RenderBoxModel renderBoxModel,
  2. String filter
)
inherited

Implementation

void updateFilterEffects(RenderBoxModel renderBoxModel, String filter) {
  List<CSSFunctionalNotation> functions = CSSFunction.parseFunction(filter);
  ColorFilter? colorFilter = _parseColorFilters(functions);
  if (colorFilter != null) {
    renderBoxModel.colorFilter = colorFilter;
  }

  RenderStyle renderStyle = renderBoxModel.renderStyle;
  ImageFilter? imageFilter = _parseImageFilters(functions, renderStyle);
  if (imageFilter != null) {
    renderBoxModel.imageFilter = imageFilter;
  }

  if (!kReleaseMode) {
    if (colorFilter == null && imageFilter == null) {
      print('[WARNING] Parse CSS Filter failed or not supported: "$filter"');
      String supportedFilters = '$GRAYSCALE $SEPIA $BLUR';
      print('Kraken only support following filters: $supportedFilters');
    }
  }
}