Skip to content

Created the ActivityDetailsView screen#77

Open
Brun41v35 wants to merge 8 commits intodevpass-tech:mainfrom
Brun41v35:feature/ActivityDetailsView
Open

Created the ActivityDetailsView screen#77
Brun41v35 wants to merge 8 commits intodevpass-tech:mainfrom
Brun41v35:feature/ActivityDetailsView

Conversation

@Brun41v35
Copy link
Copy Markdown

@Brun41v35 Brun41v35 commented Dec 12, 2022

Description

Created the ActivityDetailsView screen 📝

Videos

Simulator.Screen.Recording.-.iPhone.14.-.2022-12-12.at.17.23.58.mp4

return stack
}()

private lazy var productView: UIView = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dá pra resumir com uma inicialização simples

private lazy var mainStack: UIStackView = {
let stack = UIStackView()
stack.axis = .vertical
stack.distribution = .fillEqually
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqui dá pra remover já que os componentes tem instrinsicContentSize

return view
}()

private lazy var productValueView: UIView = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesma coisa

private lazy var productNameLabel: UILabel = {
let label = UILabel()
label.textAlignment = .center
label.font = UIFont.boldSystemFont(ofSize: 17)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dá pra salvar o tamanho da fonte numa constante

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outra coisa: Se a label comportar conteúdo grande, bom setar o número de linhas como zero.

return label
}()

private lazy var categoryNameLabel: UILabel = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesma coisa aqui

return label
}()

private lazy var productValue: UILabel = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renomear pra productValueLabel


private lazy var productValue: UILabel = {
let label = UILabel()
label.font = UIFont.boldSystemFont(ofSize: 34)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Salvar em constantes


private lazy var reportButton: UIButton = {
let button = UIButton()
button.layer.cornerRadius = 14
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Salvar em Constants

private lazy var reportButton: UIButton = {
let button = UIButton()
button.layer.cornerRadius = 14
button.backgroundColor = .systemBlue
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que seria bom usar a classe de botão que o Thyago criou.

let button = UIButton()
button.layer.cornerRadius = 14
button.backgroundColor = .systemBlue
button.setTitle("Report a issue", for: .normal)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Salvar a string numa constante

}()

override var hierarchies: [BaseViewHierarchy] {
return [BaseViewHierarchy.init(parentView: self, subViews: [mainStack, reportButton]),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OBS: Não precisa do return

BaseViewHierarchy.init(parentView: productValueView, subViews: [productValue, purchaseTime])]
}

override var constraints: [NSLayoutConstraint] {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Salvar as constantes das constraints em Constants

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pular linha e deixar um comentário pra cada componente que adiciona constraints.


productImage.centerXAnchor.constraint(equalTo: centerXAnchor),

productNameLabel.centerXAnchor.constraint(equalTo: centerXAnchor),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sempre é bom colocar além do centro da label os limites.

reportButton.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 20),
reportButton.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -15),
reportButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -20),
reportButton.heightAnchor.constraint(equalToConstant: 56)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O botão poderia ter um intrinsicContentSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants