Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed Dec 20, 2023
1 parent b6cad20 commit 722422a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions ui/cryptomaterial/modal.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ func (m *Modal) Layout(gtx layout.Context, widgets []layout.Widget, width ...flo
Top: unit.Dp(30),
Bottom: unit.Dp(30),
}
insetUniform := layout.UniformInset(m.padding)
uniformInset := layout.UniformInset(m.padding)
horizontalMargin := values.MarginPaddingTransform(m.isMobileView, values.MarginPadding24)
insetUniform.Left = horizontalMargin
insetUniform.Right = horizontalMargin
uniformInset.Left = horizontalMargin
uniformInset.Right = horizontalMargin
return inset.Layout(gtx, func(gtx C) D {
return layout.Stack{Alignment: layout.Center}.Layout(gtx,
layout.Expanded(func(gtx C) D {
Expand All @@ -147,7 +147,7 @@ func (m *Modal) Layout(gtx layout.Context, widgets []layout.Widget, width ...flo
Orientation: layout.Vertical,
Width: WrapContent,
Height: WrapContent,
Padding: insetUniform,
Padding: uniformInset,
Alignment: layout.Middle,
Border: Border{
Radius: Radius(14),
Expand All @@ -159,7 +159,7 @@ func (m *Modal) Layout(gtx layout.Context, widgets []layout.Widget, width ...flo
if m.isFloatTitle && len(widgets) > 0 {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
if m.padding == unit.Dp(0) {
return insetUniform.Layout(gtx, title)
return uniformInset.Layout(gtx, title)
}

inset := layout.Inset{
Expand Down
20 changes: 10 additions & 10 deletions ui/page/root/receive_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (pg *ReceivePage) OnNavigatedTo() {
}

func (pg *ReceivePage) generateQRForAddress() {
qrCode, err := qrcode.New(pg.currentAddress, qrcode.WithLogoImage(pg.getLogo()))
qrCode, err := qrcode.New(pg.currentAddress, qrcode.WithLogoImage(pg.getSelectedWalletLogo()))
if err != nil {
log.Error("Error generating address qrCode: " + err.Error())
return
Expand All @@ -196,7 +196,7 @@ func (pg *ReceivePage) generateQRForAddress() {
pg.qrImage = &imgdec
}

func (pg *ReceivePage) getLogo() *cryptomaterial.Image {
func (pg *ReceivePage) getSelectedWalletLogo() *cryptomaterial.Image {
pg.selectedWallet.GetAssetType()
switch pg.selectedWallet.GetAssetType() {
case utils.BTCWalletAsset:
Expand All @@ -214,15 +214,15 @@ func (pg *ReceivePage) getLogo() *cryptomaterial.Image {
// to be eventually drawn on screen.
// Part of the load.Page interface.
func (pg *ReceivePage) Layout(gtx C) D {
if pg.modalLayout != nil {
var modalWidth float32 = 450
if pg.IsMobileView() {
modalWidth = 0
}
modalContent := []layout.Widget{pg.contentLayout}
return pg.modalLayout.Layout(gtx, modalContent, modalWidth)
if pg.modalLayout == nil {
return pg.contentLayout(gtx)
}
var modalWidth float32 = 450
if pg.IsMobileView() {
modalWidth = 0
}
return pg.contentLayout(gtx)
modalContent := []layout.Widget{pg.contentLayout}
return pg.modalLayout.Layout(gtx, modalContent, modalWidth)
}

func (pg *ReceivePage) contentLayout(gtx C) D {
Expand Down

0 comments on commit 722422a

Please sign in to comment.