Sergey Y.
03/14/2021, 11:58 PMgbaldeck
03/15/2021, 3:19 AMalbertosh
03/15/2021, 1:52 PMandroidx.compose.material.DropdownMenu
) it but the IDE can’t find it. I’m using version 0.3.2
of composetheapache64
03/15/2021, 3:07 PMdirChooser
flag, is there any way to define default installation directory? I read it's possible via `jpackage`'s --install-dir
option, but how can I pass that param from build.gradle.kts
? 🤔Yan Pujante
03/15/2021, 4:43 PMprivate val _pendingIOs = MutableStateFlow(0)
val pendingIOs: StateFlow<Int>
get() = _pendingIOs
fun createPart(): Flow<Part> = flow {
val e = coroutineScope {
withContext(Dispatchers.Main) {
<http://logger.info|logger.info>("executing in Main")
_pendingIOs.value++
try {
async(<http://Dispatchers.IO|Dispatchers.IO>) {
delay(100) // simulate io delay
Part(_nextPartId++, "xxx")
}.await()
} finally {
<http://logger.info|logger.info>("executing in Main")
_pendingIOs.value--
}
}
}
emit(e)
}
The idea being that I am updating a pendingIO state variable prior to executing any IO. The UI can then simply display a CircularProgressIndicator when said stateflow variable is > 0. Is this an acceptable way of doing things? Is there a better way? Is my flow code correct or could be simplified?Casey Brooks
03/15/2021, 7:41 PMrun
task, but I get `NoClassDefFoundError`s when running with runDistributable
that I believe are because of how jlink/jpackage is packaging it with some of my Java dependencies. I’ve never done anything with JPMS, so it would be nice to have a guide for getting that configured properly with the Gradle plugin, module-info.java
, and anything else that’s neededsamuel
03/15/2021, 11:13 PMTextFieldValue
input, is there a way to specify the type that is expected or is it always expected to be a string
(TextFieldValue.text
) For example could i have an arbitrary KotlinType
that i could use for validation directly?Vahalaru
03/16/2021, 3:24 AMTrevor Merritt
03/16/2021, 12:46 PMPHondogo
03/16/2021, 1:28 PMPHondogo
03/16/2021, 2:36 PMandroidx.compose.compiler.plugins.kotlin.IncompatibleComposeRuntimeVersionException: You are using an outdated version of Compose Runtime that is not compatible with the version of the Compose Compiler plugin you have installed. The compose compiler plugin you are using (version 1.0.0-alpha13) expects a minimum runtime version of 1.0.0-alpha13.
albertosh
03/16/2021, 5:34 PMNikky
03/16/2021, 11:07 PMStore<T>
or Store<List<T>>
type? i have only used something similar in fritz2
but.. if i want to build a desktop UI,might as well check if i can do it "right"
or in other words.. can i render a StateFlow<T>
and have the UI rebuild as as the value changes ?homchom
03/17/2021, 3:02 AMTimo Drick
03/17/2021, 4:04 AMPHondogo
03/17/2021, 8:04 AMTimo Drick
03/17/2021, 2:35 PMShabinder Singh
03/17/2021, 8:16 PMplaceholder
parameter.
is this a compiler bug?Shabinder Singh
03/18/2021, 1:22 AM./gradlew :desktop:packageDeb
./gradlew :desktop:runDistributable
./gradlew :desktop:createDistributable
Running Locally using ./gradlew :desktop:run
works fine!Vahalaru
03/18/2021, 6:28 AMYan Pujante
03/18/2021, 2:57 PMOutlinedTextField
when it gets resized
My original code (which I was having issue with):
OutlinedTextField(searchFilter.value,
onValueChange = { searchFilter.value = it },
trailingIcon = {
Icon(
Icons.Outlined.Search,
contentDescription = "filter",
)
},
modifier = Modifier.height(40.dp)
)
It this a bug or the intended behavior? Is there anything I can do to change the behavior (I would like to use 40.dp
)?Nikky
03/18/2021, 7:18 PMState<List<MyData>>
how would i use a layout compontn like Rowm Column or smth else to render each element in the list ?
essentially, can i do a renderEach ?Slackbot
03/18/2021, 7:26 PMDirk Hoffmann
03/19/2021, 9:59 AMPopup
on hitting Escape key? (as the following does not work):
Popup(alignment, IntOffset(0, verticalOffset), isFocusable = true) {
Card(
Modifier.border(5.dp, Color.LightGray).size(350.dp, 200.dp)
.onPreviewKeyEvent { when (it.key) {
Key.Escape -> {
onDismissRequest()
true
}
else -> false
}}
) {
...
onPreviewKeyEvent
is never executedDirk Hoffmann
03/19/2021, 1:39 PMModifier.clickable { }
and/or
Modifier.pointerInput(Unit) {
detectTapGestures(
onPress = {/* Called when the gesture starts */ },
onDoubleTap = { /* Called on Double Tap */ },
onLongPress = { /* Called on Long Press */ },
onTap = { /* Called on Tap */ }
)
}
how could I detect a Mouse right button click ??Olivier Patry
03/19/2021, 2:03 PMvectorXmlResource
but it fails with a NPE, form openResourceStream
. I guess my problem comes from my Gradle configuration not packaging my assets in the final Jar file but I don't know how to fix that. Any clue?
desktop-app/src/main/kotlin
for the source code, desktop-app/src/main/resources
for the assets. I put an icons/
dir within resources/
which contains my Android Vector drawables and then I use vectorXmlResource("icons/ic_settings.xml")
.smallshen
03/20/2021, 2:40 PMYan Pujante
03/20/2021, 2:57 PMRow
lets you define which one occupies all the space available.. For example, I wanted to display some text, and on the right side (=end) of the row, I want an icon, and I was able to achieve it like this:
@Composable
fun TestLayout() {
val border = Modifier.border(1.dp, color = Color.Red)
Row(modifier = Modifier.fillMaxWidth().padding(10.dp)) {
Text("Text", modifier = border.weight(1f)) // weighted
Icon(Icons.Outlined.Refresh, contentDescription = "refresh", modifier = border) // unweighted
}
}
Yan Pujante
03/20/2021, 5:03 PMclass Model {
var value1 by mutableStateOf(0)
private set
var value2 = 0
private set
fun onClick1() { value1++ }
fun onClick2() { value2++ }
}
val model = Model()
@Composable
fun TestModel() {
val m = Modifier.padding(10.dp)
Column {
Row { Text(model.value1.toString(), modifier = m); Button(onClick = {model.onClick1()}) { Text("Val1++")} }
Row { Text(model.value2.toString(), modifier = m); Button(onClick = {model.onClick2()}) { Text("Val2++")} }
}
}
which produces the result in the attached screenshot.
I have a few questions:
1) Is it valid to have the state in an external object (like) Model (as opposed to have it directly inside the composable function)? Are there caveats?
2) I don't understand how Compose recognizes that value1 has changed since its underlying representation is a State
but it is exposed as a simple value. How does compose know this? How is value2 different from value1 from a user point of view (IntelliJ tells me that value1 is public final var value1: Int
when using Ctrl-Q)?
3) if I understand correctly (some of) the magic of compose comes from the compiler. Is there a way to "see" this magic in action? Like a flag? (something like compiling .cpp
to .s
to "see" the assembly code)theapache64
03/20/2021, 7:57 PMtheapache64
03/20/2021, 7:57 PMDoris Liu
03/20/2021, 8:16 PManimate*AsState
is designed to only apply new animationSpec
when targetValue
changes. I'm curious what's your use case?theapache64
03/20/2021, 8:19 PMtargetValue
changes on button click, but new animationSpec
not getting applied. animateFloatAsState
takes initial animationSpec
. Can u pls check the above attached code ? I think i miss something.. am new to compose animationsDoris Liu
03/20/2021, 9:30 PMtheapache64
03/20/2021, 9:31 PM0.4.0-build174
Doris Liu
03/20/2021, 9:33 PMtheapache64
03/20/2021, 9:33 PMDoris Liu
03/20/2021, 9:35 PMtheapache64
03/20/2021, 9:35 PMDoris Liu
03/20/2021, 9:39 PMtheapache64
03/20/2021, 9:40 PMDoris Liu
03/20/2021, 9:41 PMtheapache64
03/20/2021, 9:46 PMDoris Liu
03/20/2021, 9:46 PM