Tin Tran
09/17/2021, 7:53 AMTextFieldValue
var text by remember { mutableStateOf("") }
TextField(value = TextFieldValue(text), onValueChange = {text = it.text})
gsala
09/17/2021, 8:56 AMTable
composable that displays data in rows and column of variable width/height. So far I managed to lay out the table using a `Layout`(image 1).
The cells are placed properly, but not measured properly, because I gave up on trying to understand and implement intrinsic measurements.
I need to add the grid to the table but if I try to use the cells to do so, the borders are not aligned since the cells are not measured properly (image 2)
Is there a way to draw directly on the Layout using the same coordinates I used to place the cells?ritesh
09/17/2021, 9:17 AMCircularProgressIndicator
is materialized on screen.
Box(
modifier = Modifier.fillMaxSize(),
showLoading:Boolean,
) {
LazyColumn { // displaycontent
}
if(showLoading){ // disable background screen interaction
CircularProgressIndicator()
}
}
Rizwan Minhas
09/17/2021, 9:21 AMColton Idle
09/17/2021, 11:25 AMText("first line\nsecond line")
but it just shows the \n directly in the Text widget
According to SO, I should do Text("first line\r\nsecond line")
but that didn't work either. Any thoughts?
Edit: nvm did this and it works now
myText.replace("""\n""", "\n")
PHondogo
09/17/2021, 11:43 AMColton Idle
09/17/2021, 11:47 AMiamthevoid
09/17/2021, 2:21 PMonValueChange
Sergey Zarochentsev
09/17/2021, 2:28 PMfun Modifier.requestFocus(requester: FocusRequester = FocusRequester()): Modifier = composed {
LaunchedEffect(requester) {
requester.requestFocus()
}
focusRequester(requester)
}
Cicero
09/17/2021, 3:32 PMChris Fillmore
09/17/2021, 3:34 PMUser can input text on the left of this text field, and "<http://example.com|example.com>" stays visible as the user is typing
________________________________
|<user input here> .<http://example.com|example.com>|
--------------------------------
Alternately the "<http://example.com|example.com>" could be outside the text field:
___________________
|<user input here>| .<http://example.com|example.com>
-------------------
dimsuz
09/17/2021, 4:37 PM@Composable
fun ScreenContent(state: State) {
if (state.showDialog) {
// Need to show MaterialDatePicker here
}
}
Use SideEffect
?Scott Kruse
09/17/2021, 7:01 PMexpect / actual
?brabo-hi
09/17/2021, 7:32 PMLongClick
on a TextButton
Rafs
09/17/2021, 7:35 PMSololo
09/18/2021, 3:15 AMWaqas Tahir
09/18/2021, 9:07 AMTolriq
09/18/2021, 9:49 AMtheapache64
09/18/2021, 2:20 PMexpandHorizontally
and shrinkHorizontally
accept a param named expandFrom
and shrinkTowards
respectively. But it looks like it doesn’t consider that param. OR am I doing anything wrong? More details inside 🧵Fudge
09/18/2021, 2:26 PM@Composable fun MyComponent(map: Map<Int, String>) {
val states = map.mapValues {(k,_) -> remember(k) {mutableStateOf(0) } }
for ((k,v) in map) MyStatefulComponent(v,states[k]!!)
}
On a first look, this looks fine. We host the states for map.size
items of map
in a parent component MyComponent
, and create map.size
child `MyStatefulComponent`s, each with its own state.
However, on a second look, this code makes no sense. The way remember(key)
works, is that whenever a new value is passed, the state is erased and something new is remembered. So if there are at least two elements, the state of all elements except the last one will be erased.
In practice, hocus pocus, it works. Each element of map
has its own unique state cell. No clue how.
If a child gets added to or removed from map
, it updates and keeps working. Magic!
But, in my case that I can't reproduce here, the state gets deleted whenever the map shrinks. So I want to understand: what actually makes this work?adjpd
09/18/2021, 2:34 PMShadow
in a TextStyle
and the blurRadius
is 0
then the shadow doesn't appear. Is that intended behaviour, do you think?Akram Bensalem
09/18/2021, 5:18 PMeneim
09/19/2021, 12:41 PMHien Nguyen
09/19/2021, 1:26 PM<style name="TextAppearance.TypographyStyles.Caption.Test">
<item name="fontFamily">@font/roboto_medium</item>
<item name="android:fontFamily">@font/roboto_medium</item>
<item name="android:letterSpacing">0.0</item>
</style>
eneim
09/19/2021, 1:48 PMLazyColumn(modifier = Modifier.fillMaxSize()) {
item {
Box(modifier = Modifier.fillMaxWidth().height(200.dp))
}
items(100) {
Text(text = stringResource(id = R.string.long_text))
}
}
When I scroll down, the Box is out of the screen, but not enough for it to be disposed. How can I tell that the Box is out of the screen or not without using LazyListState? (So something that works even when the LazyColumn is replaced by a scrollable Column).theapache64
09/19/2021, 4:13 PMTargetBasedAnimation
? 🤔 (Maybe something with Box
, Text
etc 😬)andrew
09/19/2021, 6:35 PMColton Idle
09/20/2021, 12:53 AMdarkmoon_uk
09/20/2021, 6:21 AMjames
09/20/2021, 7:31 AM