New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement dark mode #401
Implement dark mode #401
Conversation
I get a crash with this log when I run the app. goroutine 1 [running, locked to thread]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Remove function LableColor - Add dark mode for ticket page
- Sometimes, the application is crashed because the wallet hasn't loaded - Checking the wallet is not nil before read the config properties
- Fix darkmode for modals - Fix darkmode for receive address
- Fix some texts are not readable when switch darkmode
@@ -162,7 +163,7 @@ func (win *Window) OverviewPage(c pageCommon) layout.Widget { | |||
pg.cachedIcon = c.icons.cached | |||
|
|||
return func(gtx C) D { | |||
pg.Handler(gtx, c) | |||
pg.Handler(gtx, c, win) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need to pass the window struct to the handler method. It seems you're trying to call the reload method from the handler after toggling the dark mode option. Is there a reason you need to re-initialize the icons and pages after toggling the dark mode option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i need re-initialize pages after toggling the dark mode option.
ui/page.go
Outdated
func (win *Window) reloadPage(common pageCommon) { | ||
win.loadPage(common.icons) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a redundant wrapper for the loadPage method.
if win.wallet != nil { | ||
isDarkModeOn := win.wallet.ReadBoolConfigValueForKey("isDarkModeOn") | ||
if isDarkModeOn != win.theme.DarkMode { | ||
win.theme.SwitchDarkMode(isDarkModeOn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this method called in the overview and settings page. Shouldn't it be called just once from the settings page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I called it in the settings page to handle the button click event dark mode. In the overview page because it is the first page loaded when app startup, i can read config from the wallet in this page and switch to the dark mode.
ui/compontents.go
Outdated
@@ -71,7 +79,8 @@ func (page pageCommon) layoutUSDBalance(gtx layout.Context) layout.Dimensions { | |||
return border.Layout(gtx, func(gtx C) D { | |||
return padding.Layout(gtx, func(gtx C) D { | |||
amountDCRtoUSDString := formatUSDBalance(page.printer, page.amountDCRtoUSD) | |||
return page.theme.Label(values.TextSize14, amountDCRtoUSDString).Layout(gtx) | |||
return page.theme.Body2(amountDCRtoUSDString).Layout(gtx) | |||
//return page.theme.LabelColor(values.TextSize14, amountDCRtoUSDString, page.theme.Color.DeepBlue).Layout(gtx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove redundant comments
label := page.theme.Label(values.TextSize20, mainText) | ||
if isSwitchColor { | ||
label.Color = page.theme.Color.DeepBlue | ||
} | ||
return label.Layout(gtx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the colour for the text being done specifically here, shouldn't it be affected like other text colours in the app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve #399