Skip to content

Commit

Permalink
setAlignment support custom Alignment, like Alignment(-0.5, -0.5). (#424
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lunxinfeng authored Jan 28, 2024
1 parent dd9f712 commit 9d2a78f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/utils/calc_window_position.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ Future<Offset> calcWindowPosition(
visibleStartX + visibleWidth - windowSize.width,
visibleStartY + (visibleHeight - windowSize.height),
);
} else {
final left = (visibleWidth - windowSize.width) / 2 + alignment.x * ((visibleWidth - windowSize.width) / 2);
final top = (visibleHeight - windowSize.height) / 2 + alignment.y * ((visibleHeight - windowSize.height) / 2);
position = Offset(
visibleStartX + left,
visibleStartY + top,
);
}
return position;
}

0 comments on commit 9d2a78f

Please sign in to comment.