라이브 전체보기 그리드 레이아웃 조정
This commit is contained in:
@@ -13,13 +13,15 @@ struct LiveNowAllView: View {
|
||||
@StateObject var viewModel = LiveViewModel()
|
||||
@StateObject var liveAllViewModel = LiveAllViewModel()
|
||||
|
||||
let columns = [
|
||||
GridItem(.flexible(), alignment: .top),
|
||||
GridItem(.flexible(), alignment: .top)
|
||||
]
|
||||
|
||||
let spacing: CGFloat = 16
|
||||
|
||||
var columns: [GridItem] {
|
||||
[
|
||||
GridItem(.flexible(), spacing: spacing, alignment: .top),
|
||||
GridItem(.flexible(), spacing: spacing, alignment: .top)
|
||||
]
|
||||
}
|
||||
|
||||
let onClickParticipant: (Int) -> Void
|
||||
|
||||
var body: some View {
|
||||
@@ -36,11 +38,13 @@ struct LiveNowAllView: View {
|
||||
viewModel.getLiveNowList()
|
||||
},
|
||||
content: {
|
||||
let itemWidth = (proxy.size.width - (spacing * 3)) / 2
|
||||
|
||||
LazyVGrid(columns: columns, spacing: spacing) {
|
||||
ForEach(0..<viewModel.liveNowItems.count, id: \.self) { index in
|
||||
let item = viewModel.liveNowItems[index]
|
||||
|
||||
LiveNowAllItemView(item: item, itemWidth: (screenSize().width - (spacing * (CGFloat(columns.count + 1)))) / 2)
|
||||
LiveNowItemView(item: item, itemWidth: itemWidth)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
self.liveAllViewModel.selectedRoomId = item.roomId
|
||||
@@ -55,6 +59,8 @@ struct LiveNowAllView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, spacing)
|
||||
.padding(.top, spacing)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user