Mask#
CoMask๋ ์์์ circle, squircle, heart, hexagon,
star, triangle ๋ฑ 15์ข
๋ชจ์์ผ๋ก ํด๋ฆฌํํฉ๋๋ค. Flutter๋ ClipPath์ ์ปค์คํ
CustomClipper๋ก ๊ฒฝ๋ก๋ฅผ ๊ณ์ฐํ๊ณ , Web์ daisyUI
mask-* CSS ํด๋์ค๋ฅผ ์ฌ์ฉํฉ๋๋ค.
Live Preview#
default
Web
Flutter
Loading Flutter...
class MaskDefaultExample extends StatelessComponent {
const MaskDefaultExample({super.key});
@override
Component build(BuildContext context) {
final cs = context.theme.colorScheme;
return CoMask(
child: div(
[],
classes: 'w-${CoreSpace.scale.space64} h-${CoreSpace.scale.space64} '
'bg-${cs.primary}',
),
);
}
}
class MaskDefaultExample extends StatelessWidget {
const MaskDefaultExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
child: Container(color: Theme.of(context).colorScheme.primary),
),
);
}
}
circle
Web
Flutter
Loading Flutter...
class MaskCircleExample extends StatelessComponent {
const MaskCircleExample({super.key});
@override
Component build(BuildContext context) {
final cs = context.theme.colorScheme;
return CoMask(
shape: .circle,
child: div(
[],
classes: 'w-${CoreSpace.scale.space64} h-${CoreSpace.scale.space64} '
'bg-${cs.primary}',
),
);
}
}
class MaskCircleExample extends StatelessWidget {
const MaskCircleExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
shape: .circle,
child: Container(color: Theme.of(context).colorScheme.primary),
),
);
}
}
heart
Web
Flutter
Loading Flutter...
class MaskHeartExample extends StatelessComponent {
const MaskHeartExample({super.key});
@override
Component build(BuildContext context) {
final cs = context.theme.colorScheme;
return CoMask(
shape: .heart,
child: div(
[],
classes: 'w-${CoreSpace.scale.space64} h-${CoreSpace.scale.space64} '
'bg-${cs.primary}',
),
);
}
}
class MaskHeartExample extends StatelessWidget {
const MaskHeartExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
shape: .heart,
child: Container(color: Theme.of(context).colorScheme.primary),
),
);
}
}
hexagon
Web
Flutter
Loading Flutter...
class MaskHexagonExample extends StatelessComponent {
const MaskHexagonExample({super.key});
@override
Component build(BuildContext context) {
final cs = context.theme.colorScheme;
return CoMask(
shape: .hexagon,
child: div(
[],
classes: 'w-${CoreSpace.scale.space64} h-${CoreSpace.scale.space64} '
'bg-${cs.primary}',
),
);
}
}
class MaskHexagonExample extends StatelessWidget {
const MaskHexagonExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
shape: .hexagon,
child: Container(color: Theme.of(context).colorScheme.primary),
),
);
}
}
star
Web
Flutter
Loading Flutter...
class MaskStarExample extends StatelessComponent {
const MaskStarExample({super.key});
@override
Component build(BuildContext context) {
final cs = context.theme.colorScheme;
return CoMask(
shape: .star,
child: div(
[],
classes: 'w-${CoreSpace.scale.space64} h-${CoreSpace.scale.space64} '
'bg-${cs.primary}',
),
);
}
}
class MaskStarExample extends StatelessWidget {
const MaskStarExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
shape: .star,
child: Container(color: Theme.of(context).colorScheme.primary),
),
);
}
}
triangle
Web
Flutter
Loading Flutter...
class MaskTriangleExample extends StatelessComponent {
const MaskTriangleExample({super.key});
@override
Component build(BuildContext context) {
final cs = context.theme.colorScheme;
return CoMask(
shape: .triangle,
child: div(
[],
classes: 'w-${CoreSpace.scale.space64} h-${CoreSpace.scale.space64} '
'bg-${cs.primary}',
),
);
}
}
class MaskTriangleExample extends StatelessWidget {
const MaskTriangleExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
shape: .triangle,
child: Container(color: Theme.of(context).colorScheme.primary),
),
);
}
}
์ฌ์ฉ ์๊ธฐ#
- ์๋ฐํ์ฒ๋ผ ์ด๋ฏธ์ง๋ฅผ ํน์ ๋ชจ์์ผ๋ก ์๋ผ์ผ ํ ๋
- ์ฅ์์ฉ ๋ํ ๋ฐฐ๊ฒฝ
- ์์ด์ฝ/๋ฐฐ์ง์ ๋ ํนํ ๋ชจ์์ ์ ์ฉํ ๋
๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ#
SizedBox(
width: CoreSpace.space64,
height: CoreSpace.space64,
child: CoMask(
shape: .hexagon,
child: Container(color: Theme.of(context).colorScheme.primary),
),
)
CoMask(
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.