adte
04/18/2023, 5:53 AMadte
04/19/2023, 5:04 PMSyntheticEventSender.sendSyntheticMove
. My app is a vector graphics editor and on mouse drag, I am moving points which causes the canvas to redraw - but then it seems mouse move event is now sent on redraw (see screenshot comment), so that creates a loop of redraw-move-redraw... for me.Michael Paus
04/19/2023, 7:46 PMspierce7
04/20/2023, 1:28 AM<https://repo.maven.apache.org/maven2/org/jetbrains/>
Shushant Tiwari
04/21/2023, 2:25 AMRadoslaw Juszczyk
04/21/2023, 9:31 AMfromFiles
(see here) and then you can load them in JVM code using `System.loadLibrary("LIBRARYNAME")`_
In the link (see here) it gives an example to place it like that:
compose.desktop {
application {
. . .
fromFiles(project.fileTree("libs/") { include("**/*.jar") })
I am trying to include some .dylib
(of course I removed { include("**/*.jar") }
part) files for my project but the contents of libs/
do not seem to be copied to the resulting .app
image.
Any ideas how to get it working?Nuru Nabiyev
04/23/2023, 5:03 PM.scrollable(
state = ScrollableState {
canvasVM.offsetY += it
it
},
orientation = Orientation.Vertical
)
.scrollable(
state = ScrollableState {
canvasVM.offsetX += it
it
},
orientation = Orientation.Horizontal
)
Michael Paus
04/24/2023, 11:41 AMspierce7
04/24/2023, 3:11 PM./gradlew :app:run
compose seems to be targeting the internal variant. I've changed the order, and no matter what it seems to choose the internal variant.
Is there a way to choose what variant is run?Radoslaw Juszczyk
04/25/2023, 6:12 PMAdam Brown
04/26/2023, 4:01 AMAbdelilah El Aissaoui
04/26/2023, 12:34 PMetolstoy
04/26/2023, 1:47 PMAdam Brown
04/26/2023, 11:25 PMArjan van Wieringen
04/27/2023, 5:35 PMonDrag
modifier.Landry Norris
04/27/2023, 9:42 PMMichael Paus
04/28/2023, 12:45 PMFAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared:compileTestKotlinDesktop'.
> Could not resolve all files for configuration ':shared:desktopTestCompileClasspath'.
> Could not resolve org.jetbrains.kotlin:kotlin-test:1.8.20.
Required by:
project :shared
> Unable to find a variant of org.jetbrains.kotlin:kotlin-test:1.8.20 providing the requested capability org.jetbrains.kotlin:kotlin-test-framework-junit:
- Variant compile provides org.jetbrains.kotlin:kotlin-test:1.8.20
- Variant runtime provides org.jetbrains.kotlin:kotlin-test:1.8.20
- Variant sources provides org.jetbrains.kotlin:kotlin-test:1.8.20
- Variant javadoc provides org.jetbrains.kotlin:kotlin-test:1.8.20
- Variant platform-compile provides org.jetbrains.kotlin:kotlin-test-derived-platform:1.8.20
- Variant platform-runtime provides org.jetbrains.kotlin:kotlin-test-derived-platform:1.8.20
- Variant enforced-platform-compile provides org.jetbrains.kotlin:kotlin-test-derived-enforced-platform:1.8.20
- Variant enforced-platform-runtime provides org.jetbrains.kotlin:kotlin-test-derived-enforced-platform:1.8.20
I am sure my tests worked until recently. They are plain unit tests. Not composable function tests. How do you configure tests properly in a compose multiplatform context? Most of the Jetbrains examples don’t seem to configure any tests at all.Owen Z
04/30/2023, 2:20 PMOlivier Patry
04/30/2023, 9:57 PMClickableText
?
I followed the guidelines to achieve clickable links with the help of annotated strings but the click affordance isn't as it could.Slackbot
05/01/2023, 8:33 PMBeta Tech
05/02/2023, 7:15 PMHussein El Feky
05/03/2023, 9:25 PMMateu
05/05/2023, 3:18 PMdata class AppState(val text: String, val number: Int){
companion object{
val Empty = AppState("", 0)
}
}
class AppViewModel(viewModelScope: CoroutineScope) {
private val randomNumber = flow{
while(true) {
emit(Random.nextInt())
delay(1000)
}
}
private val textField = MutableStateFlow("")
val state: StateFlow<AppState> = combine(
textField,
randomNumber,
::AppState,
).stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(),
initialValue = AppState.Empty,
)
fun updateText(text: String){
textField.value = text
}
}
@Composable
fun App() {
val viewModelScope = rememberCoroutineScope()
val viewModel = remember{AppViewModel(viewModelScope)}
val viewState by viewModel.state.collectAsState(Dispatchers.Main.immediate)
Column {
TextField(viewState.text, onValueChange = viewModel::updateText)
Text(viewState.number.toString())
}
}
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
App()
}
}
If you play the example and press two letters very (very) fast, the first one is omitted.
I think that the issue is described in the following post: https://medium.com/androiddevelopers/effective-state-management-for-textfield-in-compose-d6e5b070fbe5
For short, there is a race condition and before the TextField is modified after the combine, the second letter is pressed, so the onchange does not contain the first letter.
I've tried to look in many examples moving in internet, but most of them do not contain textFields. The only example that I've found that can apply is Tivi from @cb . In this line https://github.com/chrisbanes/tivi/blob/dffc1e9036cad936bc78236ce9e017bed21e7e7b/ui/search/src/main/java/app/tivi/home/search/Search.kt#L142
he uses a secondary state to store the textfield Input, and the textfield value is not updated with the main state. This is the only solution? We need to create a separate state for the textfields?
As you can see I'm allready using collectAsState(Dispatchers.Main.immediate) that is one of the solutions that I've found in internet, but does not seem to help at all.
Thanks!ray_yuanliu
05/06/2023, 2:49 PMRadoslaw Juszczyk
05/07/2023, 8:01 AMandroidx.compose.ui.window.DIalog
. I swear it worked fine couple of days before...
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
var isOpen by remember { mutableStateOf(false) }
MaterialTheme {
Button(onClick = {
isOpen = true
}) {
Text("OPEN")
}
}
if (isOpen) {
Dialog(
onCloseRequest = {
isOpen = false
},
title = "test"
) {
Text("DIALOG")
}
}
}
}
This is the code to reproduce it.
Has anyone experienced anything similar?
The crash happens in java (I have tried different runtimes with the same result):
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd5da76641, pid=2652, tid=14860
#
# JRE version: OpenJDK Runtime Environment (20.0.1+9) (build 20.0.1+9-29)
# Java VM: OpenJDK 64-Bit Server VM (20.0.1+9-29, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# V [jvm.dll+0x436641]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# <https://bugreport.java.com/bugreport/crash.jsp>
#
Adam Brown
05/07/2023, 8:08 AMMarc Fearby
05/07/2023, 8:41 AMandroidx.compose.ui.test
visible (so that I can see them)? I’m having trouble with something and it would help to be able to see the UI as the test is trying to execute.Giorgi
05/07/2023, 7:00 PMMichael Paus
05/08/2023, 1:04 PMClickableText
with a URL string inside the annotated text with a corresponding string annotation. When I click the URL text a browser window is opened with that URL. So my setup is working correctly. My question now is, how can I somehow temporarily highlight the URL text when the user hovers over it with the mouse so that he/she knows that there is something to click on?eygraber
05/08/2023, 8:22 PM