Didier Villevalois
01/16/2021, 9:57 AMVsevolod Ganin
01/16/2021, 1:45 PMmatchParentSize
modifier is available only in BoxScope
? It could be useful in any layout scope I think, as well as matchParentWidth
and matchParentHeight
Timo Drick
01/16/2021, 7:45 PMaherbel
01/16/2021, 7:53 PMShakil Karim
01/16/2021, 8:28 PMI'm using OutlinedTextField as follows but not sure why it crashes the app
@Composable
fun OutlinedTextFields() {
val text = remember { mutableStateOf(TextFieldValue("Text")) }
OutlinedTextField(
modifier = Modifier.fillMaxWidth(),
value = text.value,
onValueChange = { text.value = it },
label = { Text("Label") }
)
}
Halil Ozercan
01/16/2021, 9:39 PMviewBlock
is called whenever the state changes, instead of updateBlock
. I double checked every state parameter that I use in viewBlock
and confirmed that even if none of them changes, viewBlock
still gets executed.spierce7
01/16/2021, 11:55 PMAdriano Celentano
01/17/2021, 12:28 PMShakil Karim
01/17/2021, 12:48 PMval navController = rememberNavController()
NavHost(navController = navController, startDestination = FacrScreen.OnboardingAddFavoriteTeam.route) {
composable(FacrScreen.OnboardingAddFavoriteTeam.route) {
OnboardingAddFavoriteTeamScreen(facrViewModel = facrViewModel)
}
}
@HiltViewModel
class OnboardingViewModel @Inject constructor(
clubsRepository: ClubsRepository
) : ViewModel() {
val state = MutableStateFlow(OnboardingState())
init {
viewModelScope.launch {
clubsRepository.fetchAllClubs(ClubsPagingKey())
.cachedIn(viewModelScope).map {
OnboardingState(clubs = flowOf(it))
}.collect { state.value = it }
}
}
}
@Composable
fun OnboardingAddFavoriteTeamScreen() {
val onboardingViewModel: OnboardingViewModel = viewModel()
}
Rick Regan
01/17/2021, 5:49 PMTextDecoration
appear to be LineThrough
, Underline
, and None
. I tried putting "combining overline" unicode characters in the text but it puts an overline over each character, not one contiguous overline across all the characters. Is there a way to do this in Compose?aherbel
01/17/2021, 9:33 PMColton Idle
01/17/2021, 9:38 PMColton Idle
01/18/2021, 2:31 PMcontent()
and not just content
🙃
Does this seem fairly idiomatic?
@Composable
fun MyCustomContainer(header: String = "", content: @Composable () -> Unit) {
Column() {
if (header.isNotBlank()) {
Text(text = header)
}
content()
}
}
Jakub Ledwon
01/18/2021, 2:55 PMSkolson5903
01/18/2021, 8:15 PMandroidx.compose.ui:ui-test:1.0.0-alpha10
Last I see it anywhere is in androidx.ui:ui-test:1.0.0-alpha07. Does anyone have a sample unit test using this and at least alpha08 or later so I can see what I'm missing? Thanks in advance...birdsofparadise
01/18/2021, 8:54 PMabstract class ComposeAbstractTest {
@Composable
abstract fun createView()
}
class ComposeTest: ComposeAbstractTest {
@Composable
fun createView() {
Column { }
}
}
Hi is such a thing possible?
I'm getting a runtime error with my provided example and my understanding of Compose it seems like this shouldn't be possible.Mehmet Peker
01/19/2021, 2:33 AMSkolson5903
01/19/2021, 2:41 AMElnur Jeksenov
01/19/2021, 4:13 AMDenis
01/19/2021, 6:08 AMonDismissRequest will be called when the menu should close - for example when there is a tap outside the menu, or when the back key is pressedbut even the sample from that page in an otherwise empty app doesn't work as expected—the dropdown menu stays expanded if you press the back button. Only a tap outside the menu closes it.
Kshitij Patil
01/19/2021, 6:40 AMdarkTheme
to Compose Theme Adapter so that it read colors from respective theme xml?Kshitij Patil
01/19/2021, 7:14 AMrsktash
01/19/2021, 7:38 AMKort
01/19/2021, 8:50 AMText("تزامن...")
in AmbientLayoutDirection
as Ltr
, there will be an extra wrap line (see picture below). But it stays normal while as Rtl
.
Anyone have any solutions or suggestions? Thanks in advance!
Providers(AmbientLayoutDirection provides LayoutDirection.Ltr) {
Text("LTR")
Text("تزامن...")
Text("مزيد من المعلومات.")
}
Providers(AmbientLayoutDirection provides LayoutDirection.Rtl) {
Text("RTL")
Text("تزامن...")
Text("مزيد من المعلومات.")
}
Alan Yin
01/19/2021, 10:31 AMval modifier = Modifier
.preferredWidth(292.dp)
.preferredHeight(87.dp)
.clickable(onClick = { selectedItem.value = item })
if (item == selectedItem.value){
Timber.i("on item selected ")
modifier.background(brush = lightHighLightGradient)
}
Text(
modifier = modifier,
// .padding(start = 35.dp),
text = stringResource(id = item),
fontSize = 32.sp,
textAlign = TextAlign.Center
)
Philip Blandford
01/19/2021, 11:27 AMShakil Karim
01/19/2021, 1:44 PMalorma
01/19/2021, 4:41 PMTextField
clickable, so we can display a DropdownMenu
below it to select an item and set as text?Daniel
01/19/2021, 4:45 PMZach Klippenstein (he/him) [MOD]
01/19/2021, 8:23 PMButtonStyle
enum as a parameter? Given that Material has a fixed set of button styles, it seems like the parameterized version would be less code (1 fun vs 3), less duplication in documentation, and more discoverable.Zach Klippenstein (he/him) [MOD]
01/19/2021, 8:23 PMButtonStyle
enum as a parameter? Given that Material has a fixed set of button styles, it seems like the parameterized version would be less code (1 fun vs 3), less duplication in documentation, and more discoverable.jim
01/19/2021, 8:28 PMAdam Powell
01/19/2021, 8:28 PMZach Klippenstein (he/him) [MOD]
01/19/2021, 8:29 PMColton Idle
01/19/2021, 8:30 PMAdam Powell
01/19/2021, 8:31 PMandroid.widget.Button
as the platonic ideal of a button, and it led to no end of complexity in implementation and APIHalil Ozercan
01/19/2021, 8:34 PMAdam Powell
01/19/2021, 8:34 PMAlexjlockwood
01/20/2021, 3:36 AMenum
route here and it has been working well… the main reasoning being we tend to have more component styles than material, and it was overall less verbose to just have an enum
parameter compared to creating a separate function for each component style. but that is just us 🙂
we also figured we could pretty easily migrate over to the non-enum approach if we ever needed to in the future, which i guess is probably not as easy of a migration for the material library (since we aren’t publishing any of our stuff publicly)Zach Klippenstein (he/him) [MOD]
01/20/2021, 5:04 PMjim
01/20/2021, 5:11 PM"we don’t care as much about serving as an example for how to create custom components"Famous Last Words. Often these decisions end up building on each other in ways that isn't immediately obvious. If I were giving you advice, I'd suggest you follow a pattern more similar to what we are doing with material, rather than trying to use an enum. Having said that, one of the great things about Compose is that the technology is unopinionated and you are free to violate my recommendations and learn your lessons the hard way.
Zach Klippenstein (he/him) [MOD]
01/20/2021, 5:25 PM