Skip to content

Position of window in OverWindow getting unnecessarily adjusted ? #7

Description

@trhagado

I can't seem to get my Window overlays to appear where they should. It seems like the code below may be unnecessarily adjusting the position of the overlay from what is passed in the position parameter. Can you verify this and fix if you agree?

@OverRide
Future<T?> show({BuildContext? context}) => Overlayment.show(this, context: context);

Offset _calcPosition(Size screen, Size? size, Offset? moveDelta) {
if (moveDelta != null) return moveDelta;

if (position != null) {
  if (size == null) return position!;

  var xPercent = position!.dx / screen.width;
  var yPercent = position!.dy / screen.height;
  return Offset(
    position!.dx - size.width * xPercent,
    position!.dy - size.height * yPercent,
  );
}

size = size ?? const Size(0, 0);
final x = (screen.width / 2 + screen.width / 2 * alignment!.x) - (size.width * 0.5 + size.width * 0.5 * alignment!.x);
final y = (screen.height / 2 + screen.height / 2 * alignment!.y) - (size.height * 0.5 + size.height * 0.5 * alignment!.y);
return Offset(x, y);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions