瀏覽代碼

Fix Widgets page top alignment to match other sections.

Wrap the Widgets host in a constrained panel so content stays anchored near the profile row and remove excess empty space at the top on tall windows.

Made-with: Cursor
huzaifahayat12 3 月之前
父節點
當前提交
71e0ca80d9
共有 1 個文件被更改,包括 18 次插入1 次删除
  1. 18 1
      meetings_app/ViewController.swift

+ 18 - 1
meetings_app/ViewController.swift

@@ -1859,9 +1859,26 @@ private extension ViewController {
     }
 
     private func makeWidgetsPageContent() -> NSView {
-        makeWidgetsPageHost(canAddWidgets: storeKitCoordinator.hasPremiumAccess) { [weak self] in
+        let panel = NSView()
+        panel.translatesAutoresizingMaskIntoConstraints = false
+
+        let host = makeWidgetsPageHost(canAddWidgets: storeKitCoordinator.hasPremiumAccess) { [weak self] in
             self?.showPaywall()
         }
+        panel.addSubview(host)
+
+        NSLayoutConstraint.activate([
+            host.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 28),
+            host.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -28),
+            host.topAnchor.constraint(equalTo: panel.topAnchor),
+            host.bottomAnchor.constraint(lessThanOrEqualTo: panel.bottomAnchor, constant: -16)
+        ])
+
+        // Keep widgets anchored to the top instead of drifting vertically in tall windows.
+        host.setContentHuggingPriority(.required, for: .vertical)
+        host.setContentCompressionResistancePriority(.required, for: .vertical)
+
+        return panel
     }
 
     private func makePlaceholderPage(title: String, subtitle: String) -> NSView {