dimsuz
08/15/2020, 10:54 PMui-material
library Typography
is a data class which then gets used like this:
internal val TypographyAmbient = staticAmbientOf { Typography() }
I wonder why does it need to be explicitly constructed, why not have an object Typography
and then staticAmbientOf { Typography }
?
Asking because I'm making my own Typography object (non-material theme) and maybe I'll run into trouble with this.Adam Powell
08/15/2020, 10:58 PMdimsuz
08/15/2020, 10:59 PMAdam Powell
08/15/2020, 10:59 PMProviders(TypographyAmbient provides myTypographyInstance) {
// Content
}
And everything inside the content block will see that value for that ambientAdam Powell
08/15/2020, 11:01 PMdimsuz
08/15/2020, 11:02 PMTypography
class has internal constructor and is final (being data class
) so I can't really construct it differently than it's already constructed.
Oops. As I wrote the above, I noticed the secondary public constructor 🤦♂️dimsuz
08/15/2020, 11:04 PMProviders(...)
from your comment above.
By the way it feels really nice that I can just go sideways and not use MaterialTheme and build my own theme language, specified by designer. Nothing stands in a way, and I can also look at MaterialTheme as an example! Great!