• m

    molikto

    2 years ago
    I've found various cases positional memorization is the "wrong" recompose method, and I actually need a destructive update. Any suggestions better ways to handle this?
    m
    Zach Klippenstein (he/him) [MOD]
    +1
    3 replies
    Copy to Clipboard
  • Adrian Blanco

    Adrian Blanco

    2 years ago
    It seems like extending interfaces or abstract classes containing @Composable annotations has a regression in dev-06+. I have an use case where I have an interface
    interface Foo { val view: @Composable() -> Unit }
    with an implementation in a different module, using dev-06 and above fails at compile time with this error:
    error: cannot access Foo
    public final class FooImpl implements ...Foo {
    
    bad class file: .../classes.jar(.../Foo.class)
    undeclared type variable: N
    Adrian Blanco
    l
    +1
    3 replies
    Copy to Clipboard
  • c

    codeslubber

    2 years ago
    I have been on Canary Channel so I could use Compose, why is AS constantly offering me the beta releases? do they support compose now?
    c
    m
    16 replies
    Copy to Clipboard
  • Oscar Sequeiros

    Oscar Sequeiros

    2 years ago
    Is there a way to write @Composable functions after async calls?
    Oscar Sequeiros
    l
    4 replies
    Copy to Clipboard
  • m

    molikto

    2 years ago
    One thing really nice with Scala 3 is union types. It will be wonderful if Kotlin support it, then we can have a API
    fun Button(text: String | AnnotatedString | @Composable () -> Unit)
    . or implicit conversions (which is more powerful for better or worse
    m
    l
    +2
    5 replies
    Copy to Clipboard
  • g

    Guy Bieber

    2 years ago
    Question: How can you make a VerticalScroller stay scrolled to the end of the list as new data is added? Right now my data is added but the list does not move.
    VerticalScroller(
                isScrollable = true,
                child = child
            )
    g
    caelum19
    2 replies
    Copy to Clipboard
  • Chase James

    Chase James

    2 years ago
    I'm getting a weird Kotlin compiler error? Anyone know how to solve these?
    Internal error: Couldn't inline method call 'state$default' into @androidx.compose.Composable public inline fun <T> `state$default`(noinline areEquivalent: ((T, T) -> kotlin.Boolean)?, init: () -> T, `$mask0`: <http://kotlin.Int|kotlin.Int>, `$handler`: kotlin.Any?): androidx.compose.MutableState<T> defined in androidx.compose <no source>
    Chase James
    Adrian Blanco
    3 replies
    Copy to Clipboard
  • v

    Vincent tiensi

    2 years ago
    Heya! I’m having trouble wrapping my head around centering a view vertically in dev06. It looks like this and my code is like this…
    Row {
            // ...
            Container(width = 48.dp, height = 48.dp) {
                DrawVector(profilePlaceholderImage)
            }
            Spacer(modifier = LayoutPadding(start = 16.dp))
            Column {
              //  ...
              drawNameAndStars()
            }
    // This line of code isn't working as expected 
            Container(width = 14.dp, height = 14.dp, modifier = LayoutFlexible(1f) + LayoutAlign.CenterRight) {
                DrawVector(arrowVector)
            }
        }
    v
    m
    +2
    7 replies
    Copy to Clipboard
  • i

    Isaac Udy

    2 years ago
    Have method references stopped working? I'm trying to pass an @Composable function via method reference, and it fails to run (or compile, depending on how I define the withView function):
    io.khimera.example.weather.SplashScreenViewModelKt$splashScreenRouter$1$1 cannot be cast to kotlin.jvm.functions.Function2
    fun <T> withView(view: T) where T:(@Composable() (VM) -> Unit)  {
            if (this.view != null) throw IllegalStateException("Route already has view")
            this.view = view
        }
    
    ...
    withView(::SplashScreen)
    i
    r
    2 replies
    Copy to Clipboard
  • t

    Thiago

    2 years ago
    I would like to request the compose team for a fractional layout modifier. Its works better than LayoutOffset because I don't have to manager pixels. Its make sense?
    data class LayoutFractional(val dx: Float, val dy: Float) : LayoutModifier {
        override fun ModifierScope.modifyPosition(
            childSize: IntPxSize,
            containerSize: IntPxSize
        ): IntPxPosition = IntPxPosition(
            x = childSize.width * dx.coerceIn(MIN_FRACTION, MAX_FRACTION) *
                    if (layoutDirection == LayoutDirection.Ltr) MAX_FRACTION else MIN_FRACTION,
            y = childSize.height * dy.coerceIn(MIN_FRACTION, MAX_FRACTION)
        )
    
        companion object {
            private const val MAX_FRACTION = 1f
            private const val MIN_FRACTION = -1f
    
            val Origin = LayoutFractional(0f, 0f)
        }
    }
    t
    Adam Powell
    +1
    10 replies
    Copy to Clipboard