[infra_ui][overlay] Implement remaining overlap behavior

This commit is contained in:
Jaylen Bian 2021-08-08 22:04:49 +08:00
parent efa78dd456
commit 9b6871803a
2 changed files with 18 additions and 1 deletions

View File

@ -264,7 +264,6 @@ class FlowyOverlayState extends State<FlowyOverlay> {
), ),
), ),
]; ];
return Stack( return Stack(
children: children..addAll(overlays), children: children..addAll(overlays),
); );

View File

@ -55,6 +55,24 @@ class OverlayLayoutDelegate extends SingleChildLayoutDelegate {
constraints.maxHeight - anchorRect.bottom, constraints.maxHeight - anchorRect.bottom,
)); ));
break; break;
case AnchorDirection.topWithLeftAligned:
childConstraints = BoxConstraints.loose(Size(
constraints.maxWidth - anchorRect.left,
anchorRect.top,
));
break;
case AnchorDirection.topWithCenterAligned:
childConstraints = BoxConstraints.loose(Size(
constraints.maxWidth,
anchorRect.top,
));
break;
case AnchorDirection.topWithRightAligned:
childConstraints = BoxConstraints.loose(Size(
anchorRect.right,
anchorRect.top,
));
break;
case AnchorDirection.rightWithTopAligned: case AnchorDirection.rightWithTopAligned:
childConstraints = BoxConstraints.loose(Size( childConstraints = BoxConstraints.loose(Size(
constraints.maxWidth - anchorRect.right, constraints.maxWidth - anchorRect.right,