At the moment, it's pretty hard-coded: ```Text( ...
# compose-wear
g
At the moment, it's pretty hard-coded:
Copy code
Text(
    text = speed,
    color = Colors.primary,
    style = LocalTextStyle.current.copy(fontSize = 108.sp),
    fontStyle = FontStyle.Italic,
    fontWeight = FontWeight.ExtraBold
)
But as per @yschimke’s comment it would be great to know how to best make use of Theming to support this cleanly? (I like Yuri's suggestion of
WearWindTheme.typography.majorItem
) ? Any thoughts?
y
The reason I argued for this is to continue the pattern of separating the style from the content. We don't have dark mode to worry about, so state changes are less important, but it's still worth adopting a pattern that makes it easy to change styles in a single place. Maybe put up a PR for discussion?
g
https://github.com/garanj/wearwind/pull/4/files and https://github.com/garanj/wearwind/pull/3/files - went for keeping separate from MaterialTheme Typography as my use didn't seem to fit in with the meaning of the definitions. Did consider Local Composition but felt a bit much. Apologies for mangling across 2 PRs...!
Just saw your comment @yschimke - I had thought local composition looked like overkill... but now I will try it 🙂
y
It's very lightweight to implement, a handful of lines of code that you win back by removing parameters passed down through the composables, and it basically magically works including if you ever change the style at runtime via a State field.
1
c
CompositionLocals works well for small deviations. If you want to add other semantics besides what MaterialTheme gives you, there’s flexibility in extending or outright replacing Material systems. We updated our guides recently so do check them out: https://developer.android.com/jetpack/compose/themes/custom
☝🏻 1