Jelajahi Sumber

[infra_ui][overlay] Implement remaining overlap behavior

Jaylen Bian 3 tahun lalu
induk
melakukan
2d54ae8325

+ 0 - 1
app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart

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

+ 18 - 0
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,