setElementBackgroundBlur function

void setElementBackgroundBlur(
  1. Element element, [
  2. int? blurSize
])

Sets element background as a blur effect of size blurSize. Uses CSS property backdrop-filter.

Implementation

void setElementBackgroundBlur(Element element, [int? blurSize]) {
  blurSize ??= 3;
  var filter = blurSize > 0 ? 'blur(${blurSize}px)' : 'none';
  element.style.setProperty('backdrop-filter', filter);
}