我正在尝试创建一个精确的渐变。但没有成功。我尝试添加颜色值,但没有得到以下结果。我对颤振完全陌生,任何形式的帮助将不胜感激!
我的代码:
@override
void paint(Canvas canvas, Size size) {
final rect = new Rect.fromLTWH(0.0, 0.0, size.width, size.height);
final gradient = new LinearGradient(
colors: [Color(0xffF3985F),Color(0xffF28053),Color(0xffF36456),Color(0xffF24F58),Color(0xffF24D67)],
//stops: [0.0, 1.0],
begin: FractionalOffset.bottomLeft,
end: FractionalOffset.topRight,
);
var paint1 = Paint()
..shader = gradient.createShader(rect)
..style = PaintingStyle.fill;
//a rectangle
canvas.drawRect(Offset(0, 0) & Size(width, 0.35 * height), paint1);
}