Skip to content

Commit

Permalink
Fix feedback:
Browse files Browse the repository at this point in the history
- Fix some texts are not readable when switch darkmode
  • Loading branch information
tuhalang committed May 23, 2021
1 parent 4ad65f8 commit 4bf8f5f
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions ui/account_details_page.go
Expand Up @@ -167,6 +167,7 @@ func (pg *acctDetailsPage) accountBalanceLayout(gtx layout.Context, common *page
func (pg *acctDetailsPage) acctBalLayout(gtx layout.Context, balType string, mainBalance, subBalance string, isFirst bool) layout.Dimensions {
mainLabel := pg.theme.Body1(mainBalance)
subLabel := pg.theme.Caption(subBalance)
subLabel.Color = pg.theme.Color.DeepBlue
marginTop := values.MarginPadding16
marginLeft := values.MarginPadding35
if isFirst {
Expand Down
18 changes: 11 additions & 7 deletions ui/compontents.go
Expand Up @@ -30,18 +30,22 @@ const (

// layoutBalance aligns the main and sub DCR balances horizontally, putting the sub
// balance at the baseline of the row.
func (page pageCommon) layoutBalance(gtx layout.Context, amount string) layout.Dimensions {
func (page pageCommon) layoutBalance(gtx layout.Context, amount string, isSwitchColor bool) layout.Dimensions {
// todo: make "DCR" symbols small when there are no decimals in the balance
mainText, subText := breakBalance(page.printer, amount)
return layout.Flex{Axis: layout.Horizontal, Alignment: layout.Baseline}.Layout(gtx,
layout.Rigid(func(gtx C) D {
label := page.theme.Label(values.TextSize20, mainText)
label.Color = page.theme.Color.DeepBlue
if isSwitchColor {
label.Color = page.theme.Color.DeepBlue
}
return label.Layout(gtx)
}),
layout.Rigid(func(gtx C) D {
label := page.theme.Label(values.TextSize14, subText)
label.Color = page.theme.Color.DeepBlue
if isSwitchColor {
label.Color = page.theme.Color.DeepBlue
}
return label.Layout(gtx)
}),
)
Expand Down Expand Up @@ -113,7 +117,7 @@ func (page pageCommon) layoutTopBar(gtx layout.Context) layout.Dimensions {
}),
layout.Rigid(func(gtx C) D {
return layout.Center.Layout(gtx, func(gtx C) D {
return page.layoutBalance(gtx, page.info.TotalBalance)
return page.layoutBalance(gtx, page.info.TotalBalance, true)
})
}),
layout.Rigid(func(gtx C) D {
Expand Down Expand Up @@ -318,7 +322,7 @@ func transactionRow(gtx layout.Context, common pageCommon, row TransactionRow) l
return layout.Inset{Left: values.MarginPadding16}.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return common.layoutBalance(gtx, row.transaction.Balance)
return common.layoutBalance(gtx, row.transaction.Balance, true)
}),
layout.Rigid(func(gtx C) D {
if row.showBadge {
Expand Down Expand Up @@ -670,7 +674,7 @@ func (page *pageCommon) walletAccountLayout(gtx layout.Context, wallAcct walletA
acct := page.theme.Label(values.TextSize18, wallAcct.accountName)
acct.Color = page.theme.Color.Text
return endToEndRow(gtx, acct.Layout, func(gtx C) D {
return page.layoutBalance(gtx, wallAcct.totalBalance)
return page.layoutBalance(gtx, wallAcct.totalBalance, true)
})
}),
layout.Rigid(func(gtx C) D {
Expand Down Expand Up @@ -888,7 +892,7 @@ func ticketCard(gtx layout.Context, c pageCommon, t *wallet.Ticket) layout.Dimen
return layout.Inset{
Top: values.MarginPadding16,
}.Layout(gtx, func(gtx C) D {
return c.layoutBalance(gtx, t.Amount)
return c.layoutBalance(gtx, t.Amount, true)
})
}),
layout.Rigid(func(gtx C) D {
Expand Down
6 changes: 6 additions & 0 deletions ui/decredmaterial/votebar.go
Expand Up @@ -30,6 +30,7 @@ type VoteBar struct {
noColor color.NRGBA
bgColor color.NRGBA
thumbCol color.NRGBA
notifyColor color.NRGBA

yesLabel Label
noLabel Label
Expand Down Expand Up @@ -69,6 +70,7 @@ func (t *Theme) VoteBar(infoIcon, legendIcon *widget.Icon) VoteBar {
legendIcon: legendIcon,
thumbCol: t.Color.InactiveGray,
bgColor: t.Color.Gray1,
notifyColor: t.Color.Gray4,
passTooltipLabel: t.Caption(""),
totalVotesTooltipLabel: t.Caption("Total votes"),
quorumRequirementTooltipLabel: t.Caption("Quorum requirement"),
Expand Down Expand Up @@ -281,6 +283,10 @@ func (v *VoteBar) layoutInfo(gtx C) D {

func (v *VoteBar) layoutInfoTooltip(gtx C, rect image.Rectangle) {
inset := layout.Inset{Top: unit.Dp(20), Left: unit.Dp(-180)}
v.totalVotesTooltipLabel.Color = v.notifyColor
v.totalVotesCountLabel.Color = v.notifyColor
v.quorumRequirementTooltipLabel.Color = v.notifyColor
v.quorumRequirementCountLabel.Color = v.notifyColor
v.quorumTooltip.Layout(gtx, rect, inset, func(gtx C) D {
gtx.Constraints.Min.X = gtx.Px(unit.Dp(180))
gtx.Constraints.Max.X = gtx.Px(unit.Dp(180))
Expand Down
2 changes: 1 addition & 1 deletion ui/modal_templates.go
Expand Up @@ -142,7 +142,7 @@ func (m *ModalTemplate) createNewAccount() []layout.Widget {
}),
layout.Rigid(func(gtx C) D {
info := m.th.Body1(" cannot ")
info.Color = m.th.Color.Black
info.Color = m.th.Color.DeepBlue
return layout.Inset{Top: values.MarginPadding5}.Layout(gtx, func(gtx C) D {
return info.Layout(gtx)
})
Expand Down
6 changes: 3 additions & 3 deletions ui/privacy_page.go
Expand Up @@ -232,9 +232,9 @@ func (pg *privacyPage) mixerInfoLayout(gtx layout.Context, c *pageCommon) layout
}),
layout.Rigid(func(gtx C) D {
if c.wallet.IsAccountMixerActive(c.info.Wallets[*c.selectedWallet].ID) {
return c.layoutBalance(gtx, unmixedBalance)
return c.layoutBalance(gtx, unmixedBalance, true)
}
return c.layoutBalance(gtx, unmixedBalance)
return c.layoutBalance(gtx, unmixedBalance, true)
}),
)
}),
Expand All @@ -253,7 +253,7 @@ func (pg *privacyPage) mixerInfoLayout(gtx layout.Context, c *pageCommon) layout
return t.Layout(gtx)
}),
layout.Rigid(func(gtx C) D {
return c.layoutBalance(gtx, mixedBalance)
return c.layoutBalance(gtx, mixedBalance, true)
}),
)
}),
Expand Down
2 changes: 1 addition & 1 deletion ui/send_page.go
Expand Up @@ -477,7 +477,7 @@ func (pg *sendPage) confirmationModal(gtx layout.Context, common pageCommon) lay
layout.Rigid(func(gtx C) D {
return layout.Flex{}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return common.layoutBalance(gtx, pg.sendAmountDCR)
return common.layoutBalance(gtx, pg.sendAmountDCR, true)
}),
layout.Flexed(1, func(gtx C) D {
if pg.usdExchangeSet {
Expand Down
2 changes: 1 addition & 1 deletion ui/tickets_list_page.go
Expand Up @@ -234,7 +234,7 @@ func (pg *ticketPageList) ticketListLayout(gtx layout.Context, c pageCommon, tic
layout.Rigid(func(gtx C) D {
dtime := c.theme.Label(values.TextSize14, tickets[index].DateTime)
dtime.Color = c.theme.Color.Gray2
return endToEndRow(gtx, func(gtx C) D { return c.layoutBalance(gtx, tickets[index].Amount) }, dtime.Layout)
return endToEndRow(gtx, func(gtx C) D { return c.layoutBalance(gtx, tickets[index].Amount, true) }, dtime.Layout)
}),
layout.Rigid(func(gtx C) D {
l := func(gtx C) layout.Dimensions {
Expand Down
4 changes: 2 additions & 2 deletions ui/tickets_page.go
Expand Up @@ -476,7 +476,7 @@ func (pg *ticketPage) stackingRecordSection(gtx layout.Context, c pageCommon) la
return ic.Layout(gtx)
}),
layout.Rigid(func(gtx C) D {
return c.layoutBalance(gtx, "16.5112316")
return c.layoutBalance(gtx, "16.5112316", false)
}),
)
}),
Expand All @@ -503,7 +503,7 @@ func (pg *ticketPage) purchaseModal(gtx layout.Context, c pageCommon) layout.Dim
}),
layout.Rigid(func(gtx C) D {
return layout.Inset{Top: values.MarginPadding8}.Layout(gtx, func(gtx C) D {
return c.layoutBalance(gtx, pg.ticketPrice)
return c.layoutBalance(gtx, pg.ticketPrice, true)
})
}),
)
Expand Down
2 changes: 1 addition & 1 deletion ui/wallet_page.go
Expand Up @@ -715,7 +715,7 @@ func (pg *walletPage) walletAccountsLayout(gtx layout.Context, name, totalBal, s
}),
layout.Flexed(1, func(gtx C) D {
return layout.E.Layout(gtx, func(gtx C) D {
return common.layoutBalance(gtx, totalBal)
return common.layoutBalance(gtx, totalBal, true)
})
}),
)
Expand Down

0 comments on commit 4bf8f5f

Please sign in to comment.