-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
overflow_menu_view.swift
40 lines (34 loc) · 1.26 KB
/
overflow_menu_view.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import SwiftUI
@available(iOS 15, *)
struct OverflowMenuView: View {
enum Dimensions {
static let destinationListHeight: CGFloat = 123
}
var model: OverflowMenuModel
var uiConfiguration: OverflowMenuUIConfiguration
weak var metricsHandler: PopupMenuMetricsHandler?
var body: some View {
VStack(
alignment: .leading,
// Leave no spaces above or below Divider, the two other sections will
// include proper spacing.
spacing: 0
) {
OverflowMenuDestinationList(
destinations: model.destinations, metricsHandler: metricsHandler,
uiConfiguration: uiConfiguration
).frame(height: Dimensions.destinationListHeight)
Divider()
OverflowMenuActionList(actionGroups: model.actionGroups, metricsHandler: metricsHandler)
// Add a spacer on iPad to make sure there's space below the list.
if uiConfiguration.presentingViewControllerHorizontalSizeClass == .regular
&& uiConfiguration.presentingViewControllerVerticalSizeClass == .regular
{
Spacer()
}
}.background(Color(.systemGroupedBackground).edgesIgnoringSafeArea(.all))
}
}