Skip to content

Instantly share code, notes, and snippets.

@TechieBlossom
Last active January 13, 2023 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TechieBlossom/533bb8ef74f22bd6ea68a5d0dc9866bc to your computer and use it in GitHub Desktop.
Save TechieBlossom/533bb8ef74f22bd6ea68a5d0dc9866bc to your computer and use it in GitHub Desktop.
ClipPath and CustomClipper
ClipPath(
clipper: HexagonClipper(radius: radius),
child: SizedBox(
width: diameter,
height: diameter,
child: ColoredBox(
color: Colors.blueAccent.withOpacity(0.7),
),
),
)
class HexagonClipper extends CustomClipper<Path> {
const HexagonClipper({
required this.radius,
});
final double radius;
@override
Path getClip(Size size) {
final center = Offset(size.width / 2, size.width / 2);
Path path = Path();
path.addPolygon(
Offset(x, y),
...
...
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment