Fix issues with account image being stretched

This commit is contained in:
Rizwan Mohamed Ibrahim 2020-07-08 15:13:10 +05:30
parent ea3149d5bc
commit 8fb95f7900
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
2 changed files with 34 additions and 15 deletions

View File

@ -11,19 +11,25 @@ import RSCore
struct AccountHeaderImageView: View {
var image: RSImage
var body: some View {
Image(rsImage: image)
.resizable()
.aspectRatio(1, contentMode: .fit)
.frame(height: 48, alignment: .center)
.padding()
HStack(alignment: .center) {
Image(rsImage: image)
.resizable()
.scaledToFit()
.frame(height: 48, alignment: .center)
.padding()
}
}
}
struct AccountHeaderImageView_Previews: PreviewProvider {
static var previews: some View {
AccountHeaderImageView(image: AppAssets.image(for: .onMyMac)!)
Group {
AccountHeaderImageView(image: AppAssets.image(for: .onMyMac)!)
AccountHeaderImageView(image: AppAssets.image(for: .feedbin)!)
AccountHeaderImageView(image: AppAssets.accountLocalPadImage)
}
}
}

View File

@ -17,8 +17,8 @@ struct SettingsAccountLabelView: View {
HStack {
Image(rsImage: accountImage!)
.resizable()
.aspectRatio(1, contentMode: .fit)
.frame(height: 32)
.scaledToFit()
.frame(width: 32, height: 32)
Text(verbatim: accountLabel).font(.title)
}
.foregroundColor(.primary).padding(4.0)
@ -27,10 +27,23 @@ struct SettingsAccountLabelView: View {
struct SettingsAccountLabelView_Previews: PreviewProvider {
static var previews: some View {
SettingsAccountLabelView(
accountImage: AppAssets.image(for: .onMyMac),
accountLabel: "On My Device"
)
.previewLayout(.fixed(width: 300, height: 44))
List {
SettingsAccountLabelView(
accountImage: AppAssets.image(for: .onMyMac),
accountLabel: "On My Device"
)
SettingsAccountLabelView(
accountImage: AppAssets.image(for: .feedbin),
accountLabel: "Feedbin"
)
SettingsAccountLabelView(
accountImage: AppAssets.accountLocalPadImage,
accountLabel: "On My iPad"
)
SettingsAccountLabelView(
accountImage: AppAssets.accountLocalPhoneImage,
accountLabel: "On My iPhone"
)
}
}
}