anyone had face a crash like this <<github.com/wxx...
# compose
a
anyone had face a crash like this <github.com/wxxsfxyzm/InstallerX-Revived/issues/843>
Copy code
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Corner size in Px can't be negative(topStart = -0.14431858, topEnd = -0.14431858, bottomEnd = 32.048107, bottomStart = 32.048107)!
        at androidx.compose.foundation.internal.InlineClassHelperKt.throwIllegalArgumentException(InlineClassHelper.kt:34)
                                                                                                          at androidx.compose.foundation.shape.CornerBasedShape.createOutline-Pq9zytI(CornerBasedShape.kt:125)
          at androidx.compose.material3.internal.AnimatedShapeKt$rememberAnimatedShape$1$1.createOutline-Pq9zytI(AnimatedShape.kt:137)
I was using it with the latest material3
1.13.0-alpha01
but i had experience this before with the `1.12.0-alpha03`` the last version it was working fine for me was the
1.12.0-alpha02
Copy code
@Composable
public fun itemShape(
    index: Int,
    totalItems: Int,
    cornerRadius: Dp = 16.dp,
): Shape {
    val shape = remember(index, totalItems, cornerRadius) {
        val top = if (index == 0) cornerRadius else 0.dp
        val bottom = if (index == totalItems - 1) cornerRadius else 0.dp
        RoundedCornerShape(top, top, bottom, bottom)
    }
    return shape
}

@Composable
public fun segmentedListItemShape(
    index: Int,
    totalItems: Int,
    cornerRadius: Dp = 16.dp,
): ListItemShapes {
    val shape = itemShape(
        index = index,
        totalItems = totalItems,
        cornerRadius = cornerRadius,
    )

    return ListItemDefaults.segmentedShapes(
        index = index,
        count = totalItems,
        defaultShapes = shapes().copy(
            shape = shape,
        ),
    )
}
the problem seems to be when the shape is changing especially with 0.dp to x.dp then vice versa