minor update on buttons and QR code to look better on iPad

pull/891/head
Ryan ZHAO 2 years ago
parent 5aaf02180a
commit ebf36c6251

@ -12,7 +12,6 @@ struct InviteAFriendScreen: View {
private let accountId: String = getUserHexEncodedPublicKey() private let accountId: String = getUserHexEncodedPublicKey()
static private let cornerRadius: CGFloat = 13 static private let cornerRadius: CGFloat = 13
static private let buttonWidth: CGFloat = 160
var body: some View { var body: some View {
ZStack(alignment: .center) { ZStack(alignment: .center) {
@ -58,7 +57,7 @@ struct InviteAFriendScreen: View {
.font(.system(size: Values.mediumFontSize)) .font(.system(size: Values.mediumFontSize))
.foregroundColor(themeColor: .textPrimary) .foregroundColor(themeColor: .textPrimary)
.frame( .frame(
maxWidth: Self.buttonWidth, maxWidth: .infinity,
minHeight: Values.mediumButtonHeight, minHeight: Values.mediumButtonHeight,
alignment: .center alignment: .center
) )
@ -80,7 +79,7 @@ struct InviteAFriendScreen: View {
.font(.system(size: Values.mediumFontSize)) .font(.system(size: Values.mediumFontSize))
.foregroundColor(themeColor: .textPrimary) .foregroundColor(themeColor: .textPrimary)
.frame( .frame(
maxWidth: Self.buttonWidth, maxWidth: .infinity,
minHeight: Values.mediumButtonHeight, minHeight: Values.mediumButtonHeight,
alignment: .center alignment: .center
) )

@ -14,7 +14,7 @@ struct RecoveryPasswordScreen: View {
static private let cornerRadius: CGFloat = 13 static private let cornerRadius: CGFloat = 13
static private let backgroundCornerRadius: CGFloat = 17 static private let backgroundCornerRadius: CGFloat = 17
static private let buttonWidth: CGFloat = 130 static private let buttonWidth: CGFloat = UIDevice.current.isIPad ? Values.iPadButtonWidth : 130
public init() throws { public init() throws {
self.mnemonic = try Identity.mnemonic() self.mnemonic = try Identity.mnemonic()
@ -136,7 +136,7 @@ struct RecoveryPasswordScreen: View {
.font(.system(size: Values.verySmallFontSize)) .font(.system(size: Values.verySmallFontSize))
.foregroundColor(themeColor: .textPrimary) .foregroundColor(themeColor: .textPrimary)
.frame( .frame(
maxWidth: Self.buttonWidth, maxWidth: .infinity,
minHeight: Values.mediumSmallButtonHeight, minHeight: Values.mediumSmallButtonHeight,
alignment: .center alignment: .center
) )
@ -157,7 +157,7 @@ struct RecoveryPasswordScreen: View {
.font(.system(size: Values.verySmallFontSize)) .font(.system(size: Values.verySmallFontSize))
.foregroundColor(themeColor: .textPrimary) .foregroundColor(themeColor: .textPrimary)
.frame( .frame(
maxWidth: Self.buttonWidth, maxWidth: .infinity,
minHeight: Values.mediumSmallButtonHeight, minHeight: Values.mediumSmallButtonHeight,
alignment: .center alignment: .center
) )

@ -73,41 +73,48 @@ struct QRCodeView: View {
var body: some View { var body: some View {
ZStack(alignment: .center) { ZStack(alignment: .center) {
RoundedRectangle(cornerRadius: Self.cornerRadius) ZStack(alignment: .center) {
.fill(themeColor: backgroundThemeColor) RoundedRectangle(cornerRadius: Self.cornerRadius)
.fill(themeColor: backgroundThemeColor)
Image(uiImage: QRCode.generate(for: string, hasBackground: hasBackground))
.resizable() Image(uiImage: QRCode.generate(for: string, hasBackground: hasBackground))
.renderingMode(.template) .resizable()
.foregroundColor(themeColor: qrCodeThemeColor) .renderingMode(.template)
.scaledToFit() .foregroundColor(themeColor: qrCodeThemeColor)
.frame( .scaledToFit()
maxWidth: .infinity, .frame(
maxHeight: .infinity maxWidth: .infinity,
) maxHeight: .infinity
.padding(.vertical, Values.smallSpacing) )
.padding(.vertical, Values.smallSpacing)
if let logo = logo {
ZStack(alignment: .center) { if let logo = logo {
Rectangle() ZStack(alignment: .center) {
.fill(themeColor: backgroundThemeColor) Rectangle()
.fill(themeColor: backgroundThemeColor)
Image(logo)
.resizable() Image(logo)
.renderingMode(.template) .resizable()
.foregroundColor(themeColor: qrCodeThemeColor) .renderingMode(.template)
.scaledToFit() .foregroundColor(themeColor: qrCodeThemeColor)
.frame( .scaledToFit()
maxWidth: .infinity, .frame(
maxHeight: .infinity maxWidth: .infinity,
) maxHeight: .infinity
.padding(.all, 4) )
.padding(.all, 4)
}
.frame(
width: Self.logoSize,
height: Self.logoSize
)
} }
.frame(
width: Self.logoSize,
height: Self.logoSize
)
} }
.frame(
maxWidth: 400,
maxHeight: 400
)
} }
.frame(maxWidth: .infinity)
} }
} }

Loading…
Cancel
Save