Skip to content

Commit

Permalink
update margin and format balance
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed Mar 15, 2024
1 parent 43ebb13 commit 77439b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ui/cryptomaterial/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func UniformPaddingWithTopInset(topInset unit.Dp, gtx layout.Context, body layou
}

func UniformPadding(gtx layout.Context, body layout.Widget, isMobileView ...bool) D {
return UniformPaddingWithTopInset(values.MarginPadding24, gtx, body, isMobileView...)
return UniformPaddingWithTopInset(values.MarginPadding0, gtx, body, isMobileView...)
}

func DisableLayout(currentPage app.Page, gtx C, titleLayout, subtitleLayout func(gtx C) D, transparency uint8, color color.NRGBA, actionButton *Button) D {
Expand Down
2 changes: 1 addition & 1 deletion ui/page/root/overview_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (pg *OverviewPage) layoutMobile(gtx C) D {
return pageContent[i](gtx)
})
})
})
}, true)
}

func (pg *OverviewPage) initInfoWallets() {
Expand Down
7 changes: 6 additions & 1 deletion ui/page/root/wallet_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,12 @@ func (pg *WalletSelectorPage) layoutNameAndBalance(gtx C, item *walletWithBalanc
}),
layout.Flexed(1, func(gtx C) D {
return layout.E.Layout(gtx, func(gtx C) D {
return components.LayoutBalanceWithStateSemiBold(gtx, pg.Load, item.totalBalance.String())
totalbalanceStr := item.totalBalance.String()
// This scope use for btc format
if totalbalanceStr == "0 BTC" {
totalbalanceStr = "0.00 BTC"
}
return components.LayoutBalanceWithStateSemiBold(gtx, pg.Load, totalbalanceStr)
})
}),
)
Expand Down
20 changes: 7 additions & 13 deletions ui/page/root/wallet_selector_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ func (pg *WalletSelectorPage) layoutDesktop(gtx C) D {
}

func (pg *WalletSelectorPage) layoutMobile(gtx C) D {
return components.UniformMobile(gtx, false, false, pg.pageContentLayout)
return components.HorizontalInset(values.MarginPadding10).Layout(gtx, pg.pageContentLayout)
// return components.UniformMobile(gtx, false, false, pg.pageContentLayout)
}

func (pg *WalletSelectorPage) pageContentLayout(gtx C) D {
Expand All @@ -250,10 +251,6 @@ func (pg *WalletSelectorPage) pageContentLayout(gtx C) D {
return pg.Theme.List(pg.assetDropdownContainer).Layout(gtx, len(supportedAssets), func(gtx C, i int) D {
top := values.MarginPadding15
bottom := values.MarginPadding0
if pg.Load.IsMobileView() {
top = values.MarginPadding0
bottom = values.MarginPadding15
}
return layout.Inset{Top: top, Bottom: bottom}.Layout(gtx, pg.assetDropdown(supportedAssets[i]))
})
}
Expand All @@ -268,15 +265,12 @@ func (pg *WalletSelectorPage) pageContentLayout(gtx C) D {
Direction: layout.Center,
}.Layout2(gtx, func(gtx C) D {
width := values.MarginPadding550
if pg.Load.IsMobileView() {
width = pg.Load.CurrentAppWidth()
if pg.IsMobileView() {
width = pg.CurrentAppWidth()
}
return cryptomaterial.LinearLayout{
Width: gtx.Dp(width),
Height: cryptomaterial.MatchParent,
Margin: layout.Inset{
Bottom: values.MarginPadding30,
},
Width: gtx.Dp(width),
Height: cryptomaterial.MatchParent,
Padding: layout.Inset{Left: values.MarginPadding16, Right: values.MarginPadding16},
}.Layout2(gtx, func(gtx C) D {
return pg.Theme.List(pg.scrollContainer).Layout(gtx, len(pageContent), func(gtx C, i int) D {
Expand Down Expand Up @@ -365,7 +359,7 @@ func (pg *WalletSelectorPage) dropdownTitleLayout(gtx C, asset libutils.AssetTyp
}.Layout(gtx,
layout.Rigid(func(gtx C) D {
// check if asset balance is nil
if pg.assetsBalance[asset] == nil {
if pg.assetsBalance[asset] == nil || pg.assetsBalance[asset].String() == "0 BTC" {
txt := pg.Theme.Label(values.TextSize16, "0.00 "+asset.String())
txt.Color = pg.Theme.Color.Text
txt.Font.Weight = font.SemiBold
Expand Down

0 comments on commit 77439b3

Please sign in to comment.