ComposeGears / ComposeGears/Valkyrie
[Previewer] Inline function will cause the preview to fail
Open
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 889
- Forks
- 26
- Avg merge
- 36m
- Merged PRs (30d)
- 2
Description
Create the following function:
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.DefaultGroupName
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.Dp
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
inline fun buildImageVector(
name: String = DefaultGroupName,
defaultWidth: Dp,
defaultHeight: Dp,
viewportWidth: Float,
viewportHeight: Float,
tintColor: Color = Color.Unspecified,
tintBlendMode: BlendMode = BlendMode.SrcIn,
autoMirror: Boolean = false,
builderAction: ImageVector.Builder.() -> Unit
): ImageVector {
contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }
return ImageVector.Builder(
name, defaultWidth, defaultHeight,
viewportWidth, viewportHeight,
tintColor, tintBlendMode, autoMirror
).apply(builderAction).build()
}
Using this function in ImageVector will cause the preview to fail:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure in the previewer with the provided inline buildImageVector function and an ImageVector use. Trace the previewer's handling of inline functions and confirm that the preview renders successfully with this function when the bug is fixed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100