https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
m

Michael Paus

07/28/2023, 12:32 PM
One of the main problems of using Material components for desktop applications is that they enforce a lot of extra space around interactive components like, e.g., buttons. This often looks strange compared to regular desktop applications. I just learned on the compose channel that this can actually be cured very easily by just switching this mechanism off globally like this:
Copy code
val isTouchDevice = remember { <Somehow determine whether running on a touch device or not> }

CompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides isTouchDevice) {

	<Your code here>

}
I just gave that a try and it really worked nicely. It is even possible to switch that at runtime, so you can let the user decide what his primary input device is. Just wanted to share that for those who did not already know this like me.
👍🏻 1
thank you color 1
👍 9
b

Big Chungus

07/28/2023, 1:45 PM
Good find!