Skip to content

Instantly share code, notes, and snippets.

@umuieme
Last active January 29, 2019 16:34
Show Gist options
  • Save umuieme/cd0f453bb9ea07848594dcf793483d0e to your computer and use it in GitHub Desktop.
Save umuieme/cd0f453bb9ea07848594dcf793483d0e to your computer and use it in GitHub Desktop.
class ZigZagClipper extends CustomClipper<Path> {
ClipType clipType;
ZigZagClipper(this.clipType);
@override
Path getClip(Size size) {
Path path = Path(); // the starting point is the 0,0 position of the widget.
path.lineTo(0, size.height); // this draws the line from current point to the left bottom position of widget
path.lineTo(size.width, size.height); // this draws the line from current point to the right bottom position of the widget.
path.lineTo(size.width, 0); // this draws the line from current point to the right top position of the widget
path.close(); // this closes the loop from current position to the starting point of widget
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
// TODO: implement shouldReclip
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment