Friday, April 19, 2024
HomeiOS Developmentios - Record with scrollable horizontal rows - content material of variable...

ios – Record with scrollable horizontal rows – content material of variable peak gadgets cropped


I’ve a Record, that accommodates gadgets the place every of them is horizontal ScrolView with variable peak gadgets (relying on textual content line numbers). Right here is the code:

struct ContentView: View {
    var physique: some View {
        Record {
            ForEach(1..<12) { index in
                ScrollView(.horizontal, showsIndicators: false) {
                    LazyHStack(alignment: .high, spacing: 4) {
                        ForEach(1..<10) { innerIndex in
                            VStack(alignment: .main, spacing: 0) {
                                Rectangle()
                                    .body(width: 100, peak: 100)
                                    .foregroundColor(.blue)

                                let textual content = Array(repeating: "A", depend: innerIndex * index).joined(separator: " ")
                                Textual content(textual content)
                                    .font(.system(measurement: 10))
                                    .multilineTextAlignment(.main)
                                    .lineLimit(2, reservesSpace: false)
                                    .fixedSize(horizontal: false, vertical: true)
                                
                                Textual content("Merchandise no: (innerIndex)")
                                    .font(.system(measurement: 16))

                                Spacer(minLength: 0)
                            }
                            .body(width: 100)
                            .background(Coloration.yellow.opacity(0.5))
                        }
                    }
                }
                .listRowInsets(.init(high: 0, main: 0, backside: 0, trailing: 0))
                .listRowSeparator(.hidden)
            }
        }
        .listStyle(.plain)
        .surroundings(.defaultMinListRowHeight, 0)
    }
}

Right here is the way it seems to be:
enter image description here

As you’ll be able to see gadgets content material is cropped. I might anticipate the row to develop to suit the tallest merchandise.
How may I repair this concern?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments