androidx / constraintlayout

ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way
Apache License 2.0
1.06k stars 177 forks source link

Support for compose multiplatform #807

Closed jbruchanov closed 1 year ago

jbruchanov commented 1 year ago

Is there any plan to update the CL to have it supported also for compose multiplatform ?

I've done a quick overview of the repo and seems to be quite big task given the fact that the core as a compose dependency is a module written mostly, if not at all, in java.

Could please authors/owners here elaborate little bit what needs to be done to have it compose multiplatform compatible?

I'd like to contribute and I believe based on comments on stack overflow and kotlin slack, I'm not only one from community who would appreciate it and help to achieve this task.

So far few points/observations:

list of obvious imports what needs to be taken care of (basically all imports in the core/compose excluding androidx.compose.*, kotlin.math.*, kotlinx.coroutines.*, androidx.annotation.*)) which doesn't seem to be too bad

android.annotation.SuppressLint
android.graphics.Canvas
android.graphics.DashPathEffect
android.graphics.Matrix
android.graphics.Paint
android.graphics.Path
android.graphics.Rect
android.os.Handler
android.os.Looper
android.util.Log
java.io.IOException
java.io.OutputStream
java.lang.ref.WeakReference
java.net.Socket
java.text.DecimalFormat
java.util.ArrayList
java.util.Arrays
java.util.Collection
java.util.Collections
java.util.Comparator
java.util.EnumSet
java.util.HashMap
java.util.HashSet
java.util.Iterator
java.util.LinkedHashMap
java.util.List
java.util.Locale
java.util.Map
java.util.Objects
java.util.Set
kotlin.coroutines.coroutineContext
kotlin.properties.ObservableProperty
kotlin.reflect.KProperty
org.intellij.lang.annotations.Language
org.json.JSONArray
org.json.JSONObject
jafu888 commented 1 year ago

ConstraintLayout/MotionLayout Views version is java for APK size. 90+ % of our users are Views based, and some care deeply about APK size for development on Low end devices. We have had request to reduce it from its current sub 50K impact on APK.

All functionality for ConstraintLayout/MotionLayout is in Core and shared between Views and Compose. If we created a Kotlin version of Core we would fork the implementations. Core is still under active development for both Views and Compose use.

We are looking at modifying our use of Java features not compatible with Kotlin to smooth the fork of Core in the future.