dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.84k stars 1.67k forks source link

StatusBar Color Control #6159

Open mohammadaminyza opened 2 years ago

mohammadaminyza commented 2 years ago

Description

Hi. Please And StatusBar Color Controller With Dynamic Theme ( Dark Or Light) In Maui

Public API Changes

Maui

Intended Use-Case

For Android Status Bar

TanayParikh commented 2 years ago

This feature would be helpful for the iOS status bar as well.

https://sodocumentation.net/ios/topic/378/change-status-bar-color#:~:text=UIBarStyle%20options%20are%20default%2C%20black%2C%20blackOpaque%2C%20blackTranslucent.%20The,appearance%20of%20your%20navigation%20bar%20as%20you%20like.

TanayParikh commented 2 years ago

Here's a potential workaround: https://blog.verslu.is/maui/change-maui-ios-status-bar-color/

pictos commented 2 years ago

Just a heads up, we have this feature on Xamarin.CommunityToolkit, if the .NET MAUI team wants we can promote it to here, ortherwise we will migrate it to the CommunityToolkit.MAUI https://github.com/xamarin/XamarinCommunityToolkit/tree/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/StatusBar

JosHuybrighs commented 2 years ago

I am not sure whether the approach with a special renderer, the Xamarin.CommunityToolkit or a Dependency service, is the correct way of dealing with the Status bar on mobile devices. As far as I know (I can be wrong) none of the above described methods can deal with the Status bar when the splashscreen is up. I think there simply must be built-in support in the maui framework to configure the Status bar. If it isn't and a splashscreen is important (as it is for most apps) then the only way to deal with a splashscreen on android is to have a special launcher activity there where the Status bar can be configured. I assume one can still do this with maui? It's a pity however that with maui this is then still the way to deal with this.

601093318 commented 2 years ago

我希望有展示或隐藏状态太栏的api

601093318 commented 2 years ago

@TanayParikh

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Cybrosys commented 1 year ago

I would just like to ping/bump this.

That there is no styling/theming support in Maui for the status bar (in Shell?) is a bit strange. It gives me the feeling that someone forgot something, and it does not help that the new app template tries to solve (hide) this by creating a native Android colors.xml resource with matching default Maui colors.

I found out that I could use the Maui Community Toolkit, there was a StatusBarBehavior in there to "fill in the hole". However, there are limitations to what you can do with Behaviors, one being that you cannot use DynamicResource bindings. I wanted to use a DynamicResource binding because I have multiple themes that can be switched between, thus using a fixed color value or StaticResource is not an option.

The only way for me to solve this currently is to create my own ContentPage base class that checks and monitors the current resource color and programmatically interacts with the Behavior to achieve the desired result.

The solution was and is to me a bit ironical, as the definition of Behaviors is this:

.NET Multi-platform App UI (.NET MAUI) behaviors let you add functionality to user interface controls without having to subclass them. Instead, the functionality is implemented in a behavior class and attached to the control as if it was part of the control itself.

Going back to the topic, ping, bump, this. Shell/Maui styling should support styling the status bar as it is a part of the platforms. Having to use a Behavior or create base classes to solve it does not feel right.