Created
December 14, 2019 15:34
-
-
Save rrifafauzikomara/94193162de6c3645b68327d3e9b4ea19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class ClipperImage extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
var path = Path(); | |
path.lineTo(0.0, size.height - 30); | |
var firstControlPoint = Offset(size.width / 4, size.height); | |
var firstPoint = Offset(size.width / 2, size.height); | |
path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, | |
firstPoint.dx, firstPoint.dy); | |
var secondControlPoint = Offset(size.width - (size.width / 4), size.height); | |
var secondPoint = Offset(size.width, size.height - 30); | |
path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, | |
secondPoint.dx, secondPoint.dy); | |
path.lineTo(size.width, 0.0); | |
path.close(); | |
return path; | |
} | |
@override | |
bool shouldReclip(CustomClipper<Path> oldClipper) => false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment