Status Update
Comments
rv...@google.com <rv...@google.com> #2
We are planning to create a Textfield
component and publish it but we don't have a timeline for it now. I will update here once we have confirmed date for Textfield
's launch.
Regarding SnackbarHost
and Scaffold
, these components are not yet prioritized to be published in TV material3. I request you to create a Feature Request
issue for these components and if we get some +1
s on the ticket, we can think of prioritizing those as well.
Coming to theming, if you are using components from both tv.material3 and compose.material3, then you will have to provide both tv.material3.MaterialTheme
and compose.material3.MaterialTheme
at the app root. If you don't provide any one of them, the respective components will fallback to using the default material3 colors.
You can also refer to tv.material3.ColorScheme
to compose.material3.ColorScheme
. This way, your color scheme will have a single source of truth.
ro...@gmail.com <ro...@gmail.com> #3
Hi,
Thank you for the response. I'll wait for the TextField in the tv library and try to add a feature request for the other two composables.
Regarding your theming comment, it makes sense, but I can't seem to access the full (working) example of how the mapped colorscheme should be used in the App's root. Do you have any links to a complete working sample?
Thanks.
rv...@google.com <rv...@google.com> #4
Does this help?
import androidx.tv.material3.MaterialTheme as TvMaterialTheme
import androidx.tv.material3.darkColorScheme as tvDarkColorScheme
import androidx.tv.material3.lightColorScheme as tvLightColorScheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.tv.material3.ExperimentalTvMaterial3Api
@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
fun MyApp() {
val tvColorScheme = if (Math.random() < 0.5) tvDarkColorScheme() else tvLightColorScheme()
TvMaterialTheme(colorScheme = tvColorScheme) {
MaterialTheme(colorScheme = mapColorScheme(tvColorScheme = tvColorScheme)) {
// rest of your app
}
}
}
ro...@gmail.com <ro...@gmail.com> #5
Thanks! That was the missing info I needed, now the colors are working great.
rh...@gmail.com <rh...@gmail.com> #6
st...@eluv.io <st...@eluv.io> #7
Any update on TextField?
Description
Version used: androidx.tv:tv-material:1.0.0-alpha10
Devices/Android versions reproduced on: NVidia Shield (Android TV 11, Shield TV 9.1.1)
I'm converting my View system Android TV App to compose and all seems to be working fine. There are only a few composables missing from the library like:
- Scaffold
- SnackbarHost (including SnackbarData, SnackbarDuration, SnackbarHostState)
- TextField
Due to this I use these composables from "androidx.compose.material3:material3" and this causes the MaterialTheme to function strangely (as mentioned in the documentation).
Not sure to work around this, but for now I have to hardcode some colors to make it all work and look nicely.
Are these composables coming anytime soon, so I can phase out my View system App and phase in my Compose App?
Thanks.