Mohamed Ibrahim
08/07/2021, 2:26 AMAdib Faramarzi
08/07/2021, 9:41 AMBasicTextField
? 😅
I don't want to show the string that was entered as a text.Shakil Karim
08/07/2021, 9:55 AMMichael Paus
08/07/2021, 10:59 AMLouis
08/07/2021, 11:10 AMEric Ampire [MOD]
08/07/2021, 11:30 AMCLOVIS
08/07/2021, 12:03 PMNthily
08/07/2021, 12:33 PMif
or the compose animation api
to control whether a screen is displayed or not?Alexander Black
08/07/2021, 2:39 PMFlorian
08/07/2021, 6:02 PMJason Inbody
08/07/2021, 8:02 PMAnton Dmytryshyn
08/07/2021, 10:43 PMtreatmaster
08/08/2021, 3:36 AMMjahangiry75
08/08/2021, 7:20 AMcompose 1.0.1
?Alexander Sitnikov
08/08/2021, 10:23 AMSlackbot
08/08/2021, 10:59 AMPawel
08/08/2021, 12:51 PMw: ATTENTION!
This build uses unsafe internal compiler arguments:
-XXLanguage:+NonParenthesizedAnnotationsOnFunctionalTypes
This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
I would like to use compose in production and I am just wondering if I should be worried about this.Archie
08/08/2021, 1:59 PMderivedStateOf
.
In the official Documentation here: https://developer.android.com/jetpack/compose/side-effects
There is this sample code:
@Composable
fun TodoList(
highPriorityKeywords: List<String> = listOf("Review", "Unblock", "Compose")
) {
val todoTasks = remember { mutableStateListOf<String>() }
// Calculate high priority tasks only when the todoTasks or
// highPriorityKeywords change, not on every recomposition
val highPriorityTasks by remember(todoTasks, highPriorityKeywords) {
derivedStateOf {
todoTasks.filter { it.containsWord(highPriorityKeywords) }
}
}
Box(Modifier.fillMaxSize()) {
LazyColumn {
items(highPriorityTasks) { /* ... */ }
items(todoTasks) { /* ... */ }
}
/* Rest of the UI where users can add elements to the list */
}
}
Wouldn’t the same thing would be achieve even without the derivedStateOf
?
Like:
@Composable
fun TodoList(
highPriorityKeywords: List<String> = listOf("Review", "Unblock", "Compose")
) {
val todoTasks = remember { mutableStateListOf<String>() }
// Calculate high priority tasks only when the todoTasks or
// highPriorityKeywords change, not on every recomposition
val highPriorityTasks by remember(todoTasks.value, highPriorityKeywords) {
todoTasks.filter { it.containsWord(highPriorityKeywords) }
}
Box(Modifier.fillMaxSize()) {
LazyColumn {
items(highPriorityTasks) { /* ... */ }
items(todoTasks) { /* ... */ }
}
/* Rest of the UI where users can add elements to the list */
}
}
Wouldn’t this do the exact same thing?theapache64
08/08/2021, 3:02 PM* @sample androidx.activity.compose.samples.BackHandler
MBegemot
08/08/2021, 3:43 PMAlexander Black
08/08/2021, 3:48 PMrkeazor
08/08/2021, 5:54 PMPreviewActivity is not a subclass of Activity
Dmitry Chernozubov
08/08/2021, 6:53 PMJason Inbody
08/08/2021, 7:02 PMJason Inbody
08/09/2021, 2:02 AMdarkmoon_uk
08/09/2021, 2:25 AMTextField
and DropDownMenu
to make a fairly standard drop-down selection for a form.
For this I want to suppress the standard text-editing interaction with the TextField
and just respond to clicks by opening the menu. Found this becomes a bit of a catch 22 though:
• Keeping the TextField
enabled, and trying to apply an overriding clickable
modifier to it, or its parent, does not stop the TextField from capturing user interaction and behaving normally, as hoped.
• Disabling the TextField and applying clickable
to its parent gives desired behaviour, but then of course the colours look disabled too, which I don't want. So I'm trying to apply new TextFieldColors
to it, that maintain the enabled appearance. However I'm not finding this straightforward either - trying to reference the existing default colors gets you tangled up in interaction sources and stuff which does not feel necessary to be doing.
Any 3rd way I'm missing?darkmoon_uk
08/09/2021, 4:49 AMLocalContentColor
always default to black, and this default is not overridden by a MaterialTheme
block?
This means that even in Dark themes, the text colour inside a TextField
, for example, is also black, leaving it hard to read.
The API comments talk about this being 'typically' set to MaterialTheme.onSurface
- but don't say whether this is the direct responsibility of the developer, or how to do it.
This feels like something I shouldn't be handling directly - why do other Material elements adjust well to dark/light scheme, but the text inside a TextField
does not? Either I'm missing something or this is inconsistent/broken?
Edit: Straw-man solution 👉 🧵Abdalla Hassanin
08/09/2021, 6:42 AMNapa Ram
08/09/2021, 7:34 AMMarko Novakovic
08/09/2021, 9:00 AMXML
world I would have ...layout
and …layout-w600dp
. in compose do I use BoxWithConstraints
and depending on the width I present correct content?Marko Novakovic
08/09/2021, 9:00 AMXML
world I would have ...layout
and …layout-w600dp
. in compose do I use BoxWithConstraints
and depending on the width I present correct content?Adam Powell
08/09/2021, 1:07 PMMarko Novakovic
08/09/2021, 2:28 PM