-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurvepaint.dart
42 lines (36 loc) · 1.05 KB
/
curvepaint.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Drawing Paths',
home: Container(
color: Colors.white,
child: CustomPaint(
painter: CurvePainter(),
),
),
);
}
}
class CurvePainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
var paint = Paint();
paint.color = Colors.green[800];
paint.style = PaintingStyle.fill;
var path = Path();
path.moveTo(0, size.height * 0.9167);
path.quadraticBezierTo(size.width * 0.25, size.height * 0.875,
size.width * 0.5, size.height * 0.9167);
path.quadraticBezierTo(size.width * 0.75, size.height * 0.9584,
size.width * 1.0, size.height * 0.9167);
path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}