-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom_clipper.dart
59 lines (50 loc) · 1.25 KB
/
custom_clipper.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'package:flutter/material.dart';
class MyCustomClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var w = size.width;
var h = size.height;
Path path = Path();
path.lineTo(0, h);
var firstStart = Offset(size.width / 5, size.height);
var firstEnd = Offset(size.width / 2.25, size.height - 50);
path.quadraticBezierTo(
firstStart.dx,
firstStart.dy,
firstEnd.dx,
firstEnd.dy,
);
var secondStart =
Offset(size.width - (size.width / 3.4), size.height - 100);
var secondEnd = Offset(size.width, size.height - 50);
path.quadraticBezierTo(
secondStart.dx,
secondStart.dy,
secondEnd.dx,
secondEnd.dy,
);
path.lineTo(w, 0);
path.close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return false;
}
}
class MyCustomClipper2 extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var w = size.width;
var h = size.height;
Path path = Path();
// path.lineTo(w, h);
path.quadraticBezierTo(w * .5, h, w, 0);
path.close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return false;
}
}