Create a hexagon clippath on flutter

 


class HexagonClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
Path path = Path();

path
..moveTo(size.width / 2, 0) // moving to topCenter 1st, then draw the path
..lineTo(size.width, size.height * .25)
..lineTo(size.width, size.height * .75)
..lineTo(size.width * .5, size.height)
..lineTo(0, size.height * .75)
..lineTo(0, size.height * .25)
..close();

return path;
}

Comments