SimpleLine class

自由线条绘制内容

支持两种绘制模式:

  1. 传统路径模式:直接连接绘制点
  2. 贝塞尔曲线模式:使用二次贝塞尔曲线平滑连接,提供更流畅的线条效果

Simple Line Drawing Content

Supports two drawing modes:

  1. Traditional path mode: directly connects drawing points
  2. Bezier curve mode: uses quadratic bezier curves for smooth connection, providing smoother line effects
Inheritance

Constructors

SimpleLine({double minPointDistance = 2.0, bool useBezierCurve = true})
SimpleLine.data({double minPointDistance = 2.0, bool useBezierCurve = false, List<Offset>? points, DrawPath? path, required Paint paint})
SimpleLine.fromJson(Map<String, dynamic> data)
factory

Properties

contentType String
内容类型标识(用于JSON序列化)
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
minPointDistance double
最小点距离
final
paint Paint
画笔配置
getter/setter pairinherited
path DrawPath
绘制路径(为了向后兼容保留,用于传统路径模式)
getter/setter pair
points List<Offset>?
绘制点列表(用于贝塞尔曲线模式)
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useBezierCurve bool
是否使用贝塞尔曲线
final

Methods

copy() SimpleLine
复制实例,避免对象引用传递
override
draw(Canvas canvas, Size size, bool deeper) → void
绘制核心方法 canvas 画布对象 size 画布尺寸 deeper 当前是否为底层绘制(true为历史记录层,false为实时绘制层)
override
drawing(Offset nowPoint) → void
绘制过程中调用(手指移动时)
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startDraw(Offset startPoint) → void
开始绘制(手指按下时)
override
toContentJson() Map<String, dynamic>
转换为JSON内容(子类实现)
override
toJson() Map<String, dynamic>
转换为JSON对象
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited