void _drawBackground(Canvas canvas, Rect shapeBounds, Rect avatarBounds) {
//1
final paint = Paint()..color = color;
//2
final backgroundPath = Path()
..moveTo(shapeBounds.left, shapeBounds.top) //3
..lineTo(shapeBounds.bottomLeft.dx, shapeBounds.bottomLeft.dy) //4
..arcTo(avatarBounds, -pi, pi, false) //5
..lineTo(shapeBounds.bottomRight.dx, shapeBounds.bottomRight.dy) //6
..lineTo(shapeBounds.topRight.dx, shapeBounds.topRight.dy) //7
..close(); //8
//9
canvas.drawPath(backgroundPath, paint);
}
flutter ..
中的这个运算符是什么,这个运算符有什么用途。
答案 0 :(得分:0)
它是一种 dart 符号,允许您对 dart 对象 执行一系列操作,而不会影响对象的返回类型。它被称为 cascaded notation。
这个
List<String> titles = [];
titles.add(title1);
titles.add(title2);
titles.add(title3);
可以写成
List<String> titles = []
..add(title1)
..add(title2)
..add(title3);