瀏覽代碼

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 1 月之前
父節點
當前提交
71e0ca80d9
共有 1 個文件被更改,包括 18 次插入1 次删除
  1. 18 1
      meetings_app/ViewController.swift

+ 18 - 1
meetings_app/ViewController.swift

@@ -1859,9 +1859,26 @@ private extension ViewController {
1859 1859
     }
1860 1860
 
1861 1861
     private func makeWidgetsPageContent() -> NSView {
1862
-        makeWidgetsPageHost(canAddWidgets: storeKitCoordinator.hasPremiumAccess) { [weak self] in
1862
+        let panel = NSView()
1863
+        panel.translatesAutoresizingMaskIntoConstraints = false
1864
+
1865
+        let host = makeWidgetsPageHost(canAddWidgets: storeKitCoordinator.hasPremiumAccess) { [weak self] in
1863 1866
             self?.showPaywall()
1864 1867
         }
1868
+        panel.addSubview(host)
1869
+
1870
+        NSLayoutConstraint.activate([
1871
+            host.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 28),
1872
+            host.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -28),
1873
+            host.topAnchor.constraint(equalTo: panel.topAnchor),
1874
+            host.bottomAnchor.constraint(lessThanOrEqualTo: panel.bottomAnchor, constant: -16)
1875
+        ])
1876
+
1877
+        // Keep widgets anchored to the top instead of drifting vertically in tall windows.
1878
+        host.setContentHuggingPriority(.required, for: .vertical)
1879
+        host.setContentCompressionResistancePriority(.required, for: .vertical)
1880
+
1881
+        return panel
1865 1882
     }
1866 1883
 
1867 1884
     private func makePlaceholderPage(title: String, subtitle: String) -> NSView {