QuadAnnotatorBox class
四边形标注组件 支持在图片上绘制和编辑四边形区域
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- QuadAnnotatorBox
Constructors
- QuadAnnotatorBox({Key? key, required Image? image, double? width, double? height, QuadAnnotatorController? controller, QuadAnnotation? rectangle, OnVerticesChanged? onVerticesChanged, OnVertexDragStart? onVertexDragStart, OnVertexDragEnd? onVertexDragEnd, OnEdgeDragStart? onEdgeDragStart, OnEdgeDragEnd? onEdgeDragEnd, VoidCallback? onTutorialCompleted, Color backgroundColor = Colors.transparent, Color borderColor = Colors.white, Color errorColor = Colors.red, Color fillColor = Colors.transparent, Color vertexColor = Colors.white, Color highlightColor = Colors.green, double vertexRadius = 8.0, double borderWidth = 2.0, Color maskColor = Colors.transparent, BreathingAnimation breathing = const BreathingAnimation(), MagnifierConfiguration magnifier = const MagnifierConfiguration(), bool autoDetect = true, bool preview = false, bool allowEdgeDrag = true, FineAdjustmentConfiguration? fineAdjustment = const FineAdjustmentConfiguration(), TutorialConfiguration? tutorial})
-
基础构造函数,直接接收ui.Image对象
const
-
QuadAnnotatorBox.fromProvider({Key? key, required ImageProvider<
Object> ? imageProvider, double? width, double? height, QuadAnnotatorController? controller, QuadAnnotation? rectangle, OnVerticesChanged? onVerticesChanged, OnVertexDragStart? onVertexDragStart, OnVertexDragEnd? onVertexDragEnd, OnEdgeDragStart? onEdgeDragStart, OnEdgeDragEnd? onEdgeDragEnd, VoidCallback? onTutorialCompleted, Color backgroundColor = Colors.transparent, Color borderColor = Colors.white, Color errorColor = Colors.red, Color fillColor = Colors.transparent, Color vertexColor = Colors.white, Color highlightColor = Colors.green, double vertexRadius = 8.0, double borderWidth = 2.0, Color maskColor = Colors.transparent, BreathingAnimation breathing = const BreathingAnimation(), MagnifierConfiguration magnifier = const MagnifierConfiguration(), bool autoDetect = true, bool preview = false, bool allowEdgeDrag = true, FineAdjustmentConfiguration? fineAdjustment = const FineAdjustmentConfiguration(), TutorialConfiguration? tutorial}) -
从ImageProvider创建QuadAnnotatorBox的便捷构造函数
const
Properties
- allowEdgeDrag → bool
-
是否允许拖动边框来移动整个四边形
当为 false 时,只能通过拖动顶点来调整四边形,不能拖动边框移动
final
- autoDetect → bool
-
是否自动检测图片中的矩形
当为 true 时,如果没有提供初始矩形,会尝试自动检测图片中的矩形
当为 false 时,直接使用默认矩形,不进行自动检测
final
- backgroundColor → Color
-
背景色
final
- borderColor → Color
-
四边形线条颜色
final
- borderWidth → double
-
边框宽度
final
- breathing → BreathingAnimation
-
呼吸动画配置
final
- controller → QuadAnnotatorController?
-
控制器,用于外部控制组件状态
final
- errorColor → Color
-
四边形错误状态线条颜色(交叉时)
final
- fillColor → Color
-
四边形填充颜色
final
- fineAdjustment → FineAdjustmentConfiguration?
-
精调模式配置,传null则禁用精调模式
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
组件的高度(可选,如果不提供则自动适应父容器)
final
- highlightColor → Color
-
高亮颜色(拖动时显示)
final
- image → Image?
-
背景图片对象(用于显示和获取真实尺寸)
final
-
imageProvider
→ ImageProvider<
Object> ? -
图片提供者(用于显示图片,可选)
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- magnifier → MagnifierConfiguration
-
放大镜配置
final
- maskColor → Color
-
遮罩颜色(设置为透明色可关闭遮罩效果)
final
- onEdgeDragEnd → OnEdgeDragEnd?
-
边拖动结束时的回调函数(传递图片坐标系中的位置)
final
- onEdgeDragStart → OnEdgeDragEnd?
-
边拖动开始时的回调函数(传递图片坐标系中的位置)
final
- onTutorialCompleted → VoidCallback?
-
引导完成或跳过时的回调函数
final
- onVertexDragEnd → OnEdgeDragEnd?
-
顶点拖动结束时的回调函数(传递图片坐标系中的位置)
final
- onVertexDragStart → OnEdgeDragEnd?
-
顶点拖动开始时的回调函数(传递图片坐标系中的位置)
final
- onVerticesChanged → OnVerticesChanged?
-
顶点坐标变化时的回调函数
final
- preview → bool
-
是否为预览模式
当为 true 时,禁止手势操作、禁用放大镜、禁止自动检测矩形
final
- rectangle → QuadAnnotation?
-
初始矩形特征(图片真实坐标系),如果不提供则使用默认值
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tutorial → TutorialConfiguration?
-
引导配置,传null则禁用引导功能
final
- vertexColor → Color
-
顶点颜色
final
- vertexRadius → double
-
顶点半径
final
- width → double?
-
组件的宽度(可选,如果不提供则自动适应父容器)
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< QuadAnnotatorBox> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited