AnimatedDraggableOverlayWrapper class

============================================================ 可拖动 + 自动吸边 + 动画过渡 的 Overlay 包装类(方案二)

特性:

  1. 支持任意 Widget 作为子组件,尺寸自动测量
  2. 拖动时实时限制在屏幕边界内(含安全区)
  3. snapToEdge 控制松手后是否自动吸边
  4. 吸边时平滑动画过渡到最近边缘
  5. initialCorner 预设初始位置(四角 + 居中 + 自定义)
  6. 首次渲染无位移、无动画,直接出现在目标位置
  7. snapThreshold 控制距离边缘多少以内才吸边;为 null 时始终吸边
  8. 吸边优先级:左右优先,只有左右都很远且上下相对更近时才吸上下
  9. 子组件尺寸变化后自动重新测量,并保持吸边状态 / 重新约束位置

Inheritance

Constructors

AnimatedDraggableOverlayWrapper({Key? key, required Widget child, bool snapToEdge = true, DraggableCorner initialCorner = DraggableCorner.bottomRight, Offset? initialPosition, double initialMargin = 16, VoidCallback? onTap, VoidCallback? onDragStart, ValueChanged<Offset>? onDragEnd, Duration snapAnimationDuration = const Duration(milliseconds: 350), Curve snapAnimationCurve = Curves.easeOutCubic, EdgeInsets childPadding = EdgeInsets.zero, double edgeMargin = 0, double? snapThreshold})
const

Properties

child → Widget
被包裹的子组件
final
childPadding → EdgeInsets
子组件周围的留白(用于阴影、发光等不影响拖拽区域的效果)
final
edgeMargin → double
吸附到边缘时保留的额外间距(0 表示紧贴边缘)
final
hashCode → int
The hash code for this object.
no setterinherited
initialCorner → DraggableCorner
预设初始位置(角落)
final
initialMargin → double
预设角落时距离边缘的间距
final
initialPosition → Offset?
自定义初始位置(仅当 initialCorner == DraggableCorner.custom 时生效)
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDragEnd → ValueChanged<Offset>?
拖动结束回调,返回最终位置
final
onDragStart → VoidCallback?
拖动开始回调
final
onTap → VoidCallback?
点击回调(非拖动时触发)
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
snapAnimationCurve → Curve
吸边动画曲线
final
snapAnimationDuration → Duration
吸边动画时长
final
snapThreshold → double?
距离边缘多少像素以内才触发吸边。
final
snapToEdge → bool
是否在松手后自动吸附到最近的屏幕边缘
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<AnimatedDraggableOverlayWrapper>
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