includeOffset method

bool includeOffset(
  1. Offset otherOffset
)

判断位置是否在当前控件里面

Implementation

bool includeOffset(Offset otherOffset) {
  final RenderBox renderBox = currentContext?.findRenderObject() as RenderBox;
  final size = renderBox.size;
  final Offset offset = renderBox.localToGlobal(Offset.zero);
  if (otherOffset.dx > offset.dx &&
      otherOffset.dx < offset.dx + size.width &&
      otherOffset.dy > offset.dy &&
      otherOffset.dy < offset.dy + size.height) {
    return true;
  }
  return false;
}