And everything inside the content block will see that value for that ambient
Adam Powell
08/15/2020, 11:01 PM
Having a singleton there will be kind of wasteful, if you have a singleton just use the singleton. Ambients let a value be provided for a subtree of the composition; it's a service locator mechanism
d
dimsuz
08/15/2020, 11:02 PM
ah, I get that, but perhaps I wasn't clear enough. The
Typography
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 PM
Sorry. But at least I learned about
Providers(...)
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!