Skip to content

Commit

Permalink
properly load theme
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Mar 27, 2024
1 parent 0ba5ebd commit 1470037
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/aoWebWallet/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<MudNavLink style="margin-bottom:5px;" Href="about" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Info">About</MudNavLink>
</div>
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; margin-left:10px; padding:5px;">
@if(BindingContext.IsDarkMode)
@if (BindingContext.UserSettings?.IsDarkMode ?? true)
{
<MudIcon Icon="@icons[1]" Color="Color.Primary" />
}
Expand All @@ -46,9 +46,24 @@

protected override void OnInitialized()
{
BindingContext.PropertyChanged += BindingContext_PropertyChanged;

base.OnInitialized();
}

private void BindingContext_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)

Check warning on line 54 in src/aoWebWallet/Shared/NavMenu.razor

View workflow job for this annotation

GitHub Actions / build

'NavMenu.BindingContext_PropertyChanged(object?, PropertyChangedEventArgs)' hides inherited member 'MvvmComponentBase<MainViewModel>.BindingContext_PropertyChanged(object?, PropertyChangedEventArgs)'. Use the new keyword if hiding was intended.

Check warning on line 54 in src/aoWebWallet/Shared/NavMenu.razor

View workflow job for this annotation

GitHub Actions / build

'NavMenu.BindingContext_PropertyChanged(object?, PropertyChangedEventArgs)' hides inherited member 'MvvmComponentBase<MainViewModel>.BindingContext_PropertyChanged(object?, PropertyChangedEventArgs)'. Use the new keyword if hiding was intended.
{
if (e.PropertyName == nameof(MainViewModel.IsDarkMode))
{
this.StateHasChanged();
}
}

public virtual void Dispose()

Check warning on line 62 in src/aoWebWallet/Shared/NavMenu.razor

View workflow job for this annotation

GitHub Actions / build

'NavMenu.Dispose()' hides inherited member 'MvvmComponentBase<MainViewModel>.Dispose()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

Check warning on line 62 in src/aoWebWallet/Shared/NavMenu.razor

View workflow job for this annotation

GitHub Actions / build

'NavMenu.Dispose()' hides inherited member 'MvvmComponentBase<MainViewModel>.Dispose()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
{
BindingContext.PropertyChanged -= BindingContext_PropertyChanged;
}

private Task ToggleTheme()
{
return BindingContext.SetIsDarkMode(!BindingContext.IsDarkMode);
Expand Down

0 comments on commit 1470037

Please sign in to comment.