-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Introducing Theming to Material #1115
Introducing Theming to Material #1115
Conversation
@OrkhanAlikhanov Is this still |
@DanielDahan Let's close this and reopen when I start working on this feature |
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 love this!
These theme changes have completely broken my UI. Is there a way to globally disable use of themes? |
Hey! Can you share detailed information how it breaks your UI? which parts? I assume it breaks the (navigationController.navigationBar as! NavigationBar).isThemingEnabled = false |
Theming is applied for There are only two exceptions where theming is re-applied. One is To disable theming for the entire app, you can make Material/Sources/iOS/Theme.swift Lines 176 to 181 in e26faf0
|
Thanks for that information. I did as you suggested above but this surprisingly didn't restore everything to before. Now instead of blue my AppBar is white, so some part of the new code is not behaving as it did when isThemingEnabled is false. I'll continue to sprinkle my code with flags to try to get theming to be disabled. |
@muzoman If would like to join our #opensource Slack channel, we can discuss scenarios of how to better the theming feature. If you are interested, please send your email to [email protected]. |
@muzoman did you get any solution. I tried |
@MuhammadNayabButt Can you send an example project replicating the issue? You can send it to [email protected] |
@MuhammadNayabButt Yes, everything is working as expected for me. |
General
Both views and viewControllers can be themed in Material:
Views:
ViewControllers:
How to use
Setting
Theme
for the app.Getting current
Theme
object.Material has 2 themes built in. Light and dark:
Created
Themeable
views will be immediately themed with theTheme.current
.Disabling theming
Theming may (sometimes) override previously set colors. In such cases, you can use
isThemingEnabled
to disable theming for the a view (including its subviews).More
Setting theme for the a specific view or viewController hierarchy:
Sample
Here is sample app to test theming out. Button.zip
Double tap on background to change theme.