A Wave clipper for nav bars or any other usecase.
class _WaveClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
const depth = 0.4; // depth of the wave
const _s = .2; // slope of the wave
const _loc = 0.8 / 2; // location of the wave
final path = Path()
..moveTo(0, 0)
..lineTo((_loc - .05) * size.width, 0)
..cubicTo(
(_loc + _s * 0.20) * size.width,
size.height * 0.05,
_loc * size.width,
size.height * depth,
(_loc + _s * 0.50) * size.width,
size.height * depth,
)
..cubicTo(
(_loc + _s) * size.width,
size.height * depth,
(_loc + _s - _s * 0.10) * size.width,
size.height * 0.05,
(_loc + _s + 0.05) * size.width,
0,
)
..lineTo(size.width, 0)
..lineTo(size.width, size.height)
..lineTo(0, size.height)
..close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) => false;
}
It's based on curved_navigation_bar Custom painter.