ImageEditorController class
图片编辑器控制器 继承自 ChangeNotifier,用于管理所有编辑状态和业务逻辑。 UI层通过监听此控制器来响应状态变化。
- Inheritance
-
- Object
- ChangeNotifier
- ImageEditorController
Constructors
- ImageEditorController({required Image image, ImageEditorConfig config = const ImageEditorConfig()})
- 构造函数,需要传入一个初始图片
Properties
- activeDragHandle → DragHandlePosition?
-
no setter
- activeTool → EditToolsMenu
-
no setter
- canResetToOriginal → bool
-
检查是否可以完全撤销(是否与原始状态不同)
no setter
- canUndo → bool
-
检查是否可以回退(是否有历史记录)
no setter
- canvasSize → Size?
-
no setter
- config → ImageEditorConfig
-
final
- cropRect → Rect?
-
no setter
- currentRotationAngle → double
-
no setter
- handleVisualSize → double
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- image → Image
-
no setter
- isBusy → bool
-
no setter
- isCropFeatureEnabled → bool
-
no setter
- isCroppingActive → bool
-
no setter
- isFixedRotateEnabled → bool
-
是否启用固定角度旋转功能
no setter
- isFreeRotateEnabled → bool
-
是否启用自由旋转功能
no setter
- isRotateFeatureEnabled → bool
-
no setter
- isSingleToolMode → bool
-
判断是否处于单一工具模式(由 config.lockToTool 决定)
no setter
- isTextFeatureEnabled → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → double
-
no setter
- selectedTextLayerId → String?
-
no setter
-
textLayers
→ List<
TextLayerData> -
no setter
- translateX → double
-
no setter
- translateY → double
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
applyCurrentTool(
) → Future< void> - 应用当前工具的修改
-
cancelCurrentTool(
) → void - 取消当前工具的修改
-
clearTextSelection(
) → void - 清除文本选择
-
convertLockModeToTool(
LockToTool lockMode) → EditToolsMenu -
deleteSelectedTextLayer(
) → void - 删除选中的文本图层
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
exportImage(
) → Future< Image?> -
isToolEnabled(
EditToolsMenu tool) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onScaleEnd(
ScaleEndDetails details) → void -
onScaleStart(
ScaleStartDetails details) → void -
onScaleUpdate(
ScaleUpdateDetails details) → void -
onTapDown(
TapDownDetails details) → void -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetToOriginal(
) → void - 完全撤销:重置到原始图片和初始状态
-
resetTransformations(
{Image? newImage}) → void - 重置所有变换状态,通常在替换图片或完成裁剪后调用
-
rotate(
double degrees) → void - 旋转图片(按指定角度)
-
selectCropTool(
EditToolsMenu tool, {double? aspectRatio}) → void - 选择特定的裁剪工具(带宽高比)
-
selectTextLayerAt(
Offset tapPosition) → bool - 根据点击位置选择文本图层,返回是否命中
-
selectTool(
EditToolsMenu tool) → void - 切换主工具
-
setCanvasSize(
Size size) → void - UI层在布局完成后需要调用此方法设置画布尺寸
-
toString(
) → String -
A string representation of this object.
inherited
-
undoLastOperation(
) → void - 回退:撤销最后一次应用的操作
-
updateEditingText(
String text) → void -
updateFreeRotation(
double degrees) → void - @param degrees - 从滑块传来的角度值 (-45 to +45)
-
updateSelectedTextColor(
Color color) → void - 更新选中图层的颜色
-
updateSelectedTextSize(
double size) → void - 更新选中图层的大小
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited