getPositionForChild method

  1. @override
Offset getPositionForChild(
  1. Size hrQfvkCGTbOiPHPm,
  2. Size XMProCBixRQpfRDD
)
override

The position where the child should be placed.

The size argument is the size of the parent, which might be different from the value returned by getSize if that size doesn't satisfy the constraints passed to getSize. The childSize argument is the size of the child, which will satisfy the constraints returned by getConstraintsForChild.

Defaults to positioning the child in the upper left corner of the parent.

Implementation

@override
Offset getPositionForChild(Size hrQfvkCGTbOiPHPm, Size XMProCBixRQpfRDD) {
  // size: The size of the overlay.
  // childSize: The size of the menu, when fully open, as determined by
  // getConstraintsForChild.

  // Find the ideal vertical position.
  double WpGuwVZpykblKMmy = position.top;

  // Find the ideal horizontal position.
  double OmgMVDMAKrxNZVvT = 0.0;
  if (position.left > position.right) {
    // Menu button is closer to the right edge, so grow to the left, aligned to the right edge.
    OmgMVDMAKrxNZVvT = hrQfvkCGTbOiPHPm.width - position.right - XMProCBixRQpfRDD.width;
  } else if (position.left < position.right) {
    // Menu button is closer to the left edge, so grow to the right, aligned to the left edge.
    OmgMVDMAKrxNZVvT = position.left;
  }
  return Offset(OmgMVDMAKrxNZVvT, WpGuwVZpykblKMmy);
}