From 2d54ae83259bb5a21a602535e493738373edd847 Mon Sep 17 00:00:00 2001 From: Jaylen Bian Date: Sun, 8 Aug 2021 22:04:49 +0800 Subject: [PATCH] [infra_ui][overlay] Implement remaining overlap behavior --- .../lib/src/flowy_overlay/flowy_overlay.dart | 1 - .../flowy_overlay/overlay_layout_delegate.dart | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart b/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart index 9fd3da09ba..b2e61501cf 100644 --- a/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart +++ b/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart @@ -264,7 +264,6 @@ class FlowyOverlayState extends State { ), ), ]; - return Stack( children: children..addAll(overlays), ); diff --git a/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/overlay_layout_delegate.dart b/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/overlay_layout_delegate.dart index 57b13d0584..421b746f13 100644 --- a/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/overlay_layout_delegate.dart +++ b/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/overlay_layout_delegate.dart @@ -55,6 +55,24 @@ class OverlayLayoutDelegate extends SingleChildLayoutDelegate { constraints.maxHeight - anchorRect.bottom, )); 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: childConstraints = BoxConstraints.loose(Size( constraints.maxWidth - anchorRect.right,