Skip to content

UnboundedRippleIconButton optimisation #2700

@Tolriq

Description

@Tolriq

A small one but UnboundedRippleIconButton use .background(color = animatedContainerColor.value, shape = shape), that is recomposing a lot during the animation from enabled / disabled.

This can be fully avoided by replacing with

.drawWithCache {
                val outline = shape.createOutline(size, layoutDirection, this)
                onDrawWithContent {
                    drawOutline(outline, color = animatedContainerColor.value)
                    drawContent()
                }
            }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions