Manuel Wrage

    Manuel Wrage

    2 years ago
    Is it planned to provide a style ambient for each material component? E.g. a ButtonStyleAmbient to change the default style of all buttons. Because it looks like code can get a bit messy if there will be no way for global theming.
    Adam Powell

    Adam Powell

    2 years ago
    No. The existence of this in the current style and theme XML system is a regret that caused a lot of abstraction problems.
    The material theming is limited to globally applicable properties like colors and shapes that are more universal across components, not targeting specific components from outside
    Manuel Wrage

    Manuel Wrage

    2 years ago
    So what's the recommended way to achieve consistent theming troughout parts of the ui? My guess is we have to create something like @Composable fun MyThemedButton()
    Adam Powell

    Adam Powell

    2 years ago
    The color, shape and typography theming will get you quite far. The problem with theme settings for specific widgets is that it becomes more inconsistent in a hurry. It's easier to theme things consistently without them 🙂
    And yes, you can also always write your own composables that express your own style and use those consistently in a part of your UI
    Coming back to this with a real keyboard rather than phone keyboard - the problem that things like
    android:attr/defaultButtonStyle
    created is that it targets implementation details of composite widgets rather than a generally applicable api
    it made composite widgets fairly difficult to create with views while maintaining expectations that this sort of thing would work. See the Android date and time pickers over the years for a good example
    Whether a composite date picker uses a raised or outlined button for a confirm button is an implementation detail of the picker and not necessarily something that the embedding app should be able to theme out from under the picker (unless the picker exposes an API for it)
    Manuel Wrage

    Manuel Wrage

    2 years ago
    I understand your points thanks for your response.