Mask | CoUI

Mask

자식을 지정된 모양으로 클리핑하는 마스크 컴포넌트

Mask#

Mask는 자식을 circle, squircle, heart, hexagon, star, triangle 등 15종 모양으로 클리핑합니다. Flutter는 ClipPath와 커스텀 CustomClipper로 경로를 계산하고, Web은 daisyUI mask-* CSS 클래스를 사용합니다.

Live Preview#

사용 시기#

  • 아바타처럼 이미지를 특정 모양으로 잘라야 할 때
  • 장식용 도형 배경
  • 아이콘/배지에 독특한 모양을 적용할 때

기본 사용법#

SizedBox(
  width: CoreSpace.space64,
  height: CoreSpace.space64,
  child: Mask(
    shape: .hexagon,
    child: Container(color: Theme.of(context).colorScheme.primary),
  ),
)
Mask(
  shape: .hexagon,
  child: div(
    [],
    classes: 'w-\${CoreSpace.scale.space64} h-\${CoreSpace.scale.space64} '
        'bg-\${cs.primary}',
  ),
)

Props#

속성타입기본값설명
child Widget / Component 클리핑 대상 콘텐츠 (required)
shape CoreMaskShape squircle 마스크 모양
half CoreMaskHalf none 절반 잘라내기 (none / first / second)

지원되는 shape#

circle, squircle, square, heart, hexagon, hexagon2, decagon, pentagon, diamond, star, star2, triangle, triangle2, triangle3, triangle4.

관련 컴포넌트#

  • Avatar — 사람 얼굴·아이콘에 특화된 마스크 프리셋.
  • Card — 자유로운 컨테이너 레이아웃.