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
Changes from all commits
64e7f3e
bcb6181
252ce9e
87fd4f7
4ad65f8
e418236
3bf0ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ type overviewPage struct { | |
} | ||
|
||
func (win *Window) OverviewPage(c pageCommon) layout.Widget { | ||
|
||
pg := overviewPage{ | ||
theme: c.theme, | ||
tab: c.navTab, | ||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes, i need re-initialize pages after toggling the dark mode option. |
||
return pg.Layout(gtx, c) | ||
} | ||
} | ||
|
@@ -639,7 +640,16 @@ func (pg *overviewPage) walletSyncBox(gtx layout.Context, inset layout.Inset, de | |
}) | ||
} | ||
|
||
func (pg *overviewPage) Handler(eq event.Queue, c pageCommon) { | ||
func (pg *overviewPage) Handler(eq event.Queue, c pageCommon, win *Window) { | ||
|
||
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 commentThe 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 commentThe 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. |
||
win.loadPage(c.icons) | ||
} | ||
} | ||
|
||
if pg.walletInfo.Synced { | ||
pg.sync.Text = pg.text.disconnect | ||
} | ||
|
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.
Because the text in here alway display black color independent dark or light mode