Skip to content

Commit 9d2a78f

Browse files
authored
setAlignment support custom Alignment, like Alignment(-0.5, -0.5). (#424)
1 parent dd9f712 commit 9d2a78f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/src/utils/calc_window_position.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ Future<Offset> calcWindowPosition(
7979
visibleStartX + visibleWidth - windowSize.width,
8080
visibleStartY + (visibleHeight - windowSize.height),
8181
);
82+
} else {
83+
final left = (visibleWidth - windowSize.width) / 2 + alignment.x * ((visibleWidth - windowSize.width) / 2);
84+
final top = (visibleHeight - windowSize.height) / 2 + alignment.y * ((visibleHeight - windowSize.height) / 2);
85+
position = Offset(
86+
visibleStartX + left,
87+
visibleStartY + top,
88+
);
8289
}
8390
return position;
8491
}

0 commit comments

Comments
 (0)