Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Side attached overlays #23

Open
milettal opened this issue Aug 30, 2021 · 3 comments
Open

Side attached overlays #23

milettal opened this issue Aug 30, 2021 · 3 comments

Comments

@milettal
Copy link

A common use case for overlays is to have them have a fixed width and be attached to the side on a regular-width device, such as an iPad or landscape iPhone. This is true for Apple Maps.

maps-landscape

Does this library currently support this configuration?

Very impressed with the library 👍🏻

@forgot
Copy link

forgot commented Dec 3, 2021

I know the question is a few months old, but I was able to achieve this by getting the current size class from the environment, and then adding padding to the overlay view. Here's a very basic example, but I can expand on it a little more if that would be helpful.

struct MyOverlayView: View {
    
    @Environment(\.horizontalSizeClass) var horizontalSizeClass
    
    var items = Item.makeItems(50)
    
    var body: some View {
        GeometryReader { geometry in
            VStack {
                Text("Header")
                List {
                    ForEach(items) {
                        Text($0.title)
                    }
                }
                .drivingScrollView()
            }
            .padding(.trailing, horizontalSizeClass == .regular ? geometry.size.width-375 : 0)
        }
    }
    
}

@sabari-zuper
Copy link

@forgot I Can't access the side empty space view. Is there any solution to achieve the same like a map view in iPad

@sabari-zuper
Copy link

sabari-zuper commented May 14, 2024

@milettal Are you able to achieve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants