Skip to content

Instantly share code, notes, and snippets.

@AndresR173
Created June 10, 2021 17:00
Show Gist options
  • Save AndresR173/7b3aced8fc68a0fc78fcd910a85f22d2 to your computer and use it in GitHub Desktop.
Save AndresR173/7b3aced8fc68a0fc78fcd910a85f22d2 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class CurvePainter extends CustomPainter {
final Color paintColor;
CurvePainter(this.paintColor);
@override
void paint(Canvas canvas, Size size) {
final paint = Paint();
paint.color = paintColor;
paint.style = PaintingStyle.fill;
final path = Path();
path.moveTo(0, -1);
path.lineTo(0, size.height * 0.3);
path.quadraticBezierTo(
size.width * 0.1,
size.height,
size.width * 0.4,
size.height * 0.7,
);
path.quadraticBezierTo(
size.width * 0.8,
size.height * 0.1,
size.width,
size.height * 0.91,
);
path.lineTo(size.width, 0);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment