buildEdgeHitArea method

Widget? buildEdgeHitArea({
  1. required double thickness,
  2. required Widget child,
})

Builds an edge hit area widget for this handle position.

Only valid for edge handles (topCenter, bottomCenter, centerLeft, centerRight). Returns null for corner handles.

thickness is the width/height of the invisible hit area strip. child is the content (typically a MouseRegion + GestureDetector).

Implementation

Widget? buildEdgeHitArea({required double thickness, required Widget child}) {
  final halfThickness = thickness / 2;
  return switch (this) {
    ResizeHandle.topCenter => Positioned(
      left: 0,
      right: 0,
      top: -halfThickness,
      height: thickness,
      child: child,
    ),
    ResizeHandle.bottomCenter => Positioned(
      left: 0,
      right: 0,
      bottom: -halfThickness,
      height: thickness,
      child: child,
    ),
    ResizeHandle.centerLeft => Positioned(
      top: 0,
      bottom: 0,
      left: -halfThickness,
      width: thickness,
      child: child,
    ),
    ResizeHandle.centerRight => Positioned(
      top: 0,
      bottom: 0,
      right: -halfThickness,
      width: thickness,
      child: child,
    ),
    // Corner handles don't have edge hit areas
    _ => null,
  };
}