9、Flutter Widget - CustomPaint;

  使用Flutter也可以访问低级别的绘画调用。

自定义Painter ;

class MyPainter extends CustomPainter{
  @override
   void paint(Canvas canvas,Size size){
    canvas.drawLine(); 
    ...
  }

  @override
  bool shouldRepaint(CustomPainter old){
  return old.myParameter !=myParameter;
}
 
}
复制代码

将Painter添加到CustomPaint小部件中;

CustomPaint(
    size:Size(200,100),
    painter:MyPainter(),
)
复制代码

你可能感兴趣的:(移动开发)