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

iOS: Increase library list item size #881

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Swiftfin/Components/LibraryItemRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ struct LibraryItemRow: View {
private let item: BaseItemDto
private var onSelect: () -> Void

private let posterWidth: CGFloat = 60

var body: some View {
Button {
onSelect()
} label: {
HStack(alignment: .bottom) {
ImageView(item.portraitPosterImageSource(maxWidth: 60))
.posterStyle(type: .portrait, width: 60)
ImageView(item.portraitPosterImageSource(maxWidth: posterWidth))
.posterStyle(type: .portrait, width: posterWidth)
.posterShadow()

VStack(alignment: .leading) {
Expand Down
6 changes: 4 additions & 2 deletions Swiftfin/Components/PagingLibraryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ struct PagingLibraryView: View {

private var onSelect: (BaseItemDto) -> Void

private let portraitPosterScale = 1.25

private var gridLayout: NSCollectionLayoutSection.GridLayoutMode {
if libraryGridPosterType == .landscape && UIDevice.isPhone {
return .fixedNumberOfColumns(2)
} else {
return .adaptive(withMinItemSize: libraryGridPosterType.width + (UIDevice.isIPad ? 10 : 0))
return .adaptive(withMinItemSize: libraryGridPosterType.width * portraitPosterScale + 10)
}
}

Expand Down Expand Up @@ -62,7 +64,7 @@ struct PagingLibraryView: View {
private var libraryGridView: some View {
CollectionView(items: viewModel.items.elements) { _, item, _ in
PosterButton(state: .item(item), type: libraryGridPosterType)
.scaleItem(libraryGridPosterType == .landscape && UIDevice.isPhone ? 0.85 : 1)
.scaleItem(libraryGridPosterType == .landscape && UIDevice.isPhone ? 0.85 : portraitPosterScale)
.onSelect {
onSelect(item)
}
Expand Down