Mesh Gradients in Compose 1.12#936
Conversation
* Created `MeshGradientSnippets.kt` featuring examples for basic, complex, and animated mesh gradients using `MeshGradientPainter`. * Included demonstrations of vertex positioning, color mapping, and custom control points for manipulating mesh curves.
|
Here is the summary of changes. You are about to add 4 region tags.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Code Review
This pull request introduces new Jetpack Compose snippets demonstrating the usage of MeshGradientPainter for basic, control-point-based, complex, and animated mesh gradients. It also updates the Compose BOM version to an alpha release (2026.05.01) and bumps the compileSdk version to 37 in the wearcompanion module. Regarding the feedback, an issue was identified in the MeshGradientAnimation snippet where the gradientPainter is remembered without any keys while capturing the animatedOffset state. This will prevent the painter from updating during the animation, keeping the gradient static. It is recommended to pass animatedOffset as a key to remember.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| val pink = Color(0xFFFF2D55) | ||
|
|
||
|
|
||
| val gradientPainter = remember { |
There was a problem hiding this comment.
The gradientPainter is remembered without any keys, but its builder block captures and reads the animatedOffset state. Because remember without keys only runs once during initial composition, the painter will not be recreated or updated when animatedOffset changes, causing the gradient to remain completely static. Adding animatedOffset as a key to remember ensures the painter is updated/recreated as the animation progresses.
| val gradientPainter = remember { | |
| val gradientPainter = remember(animatedOffset) { |
kkuan2011
left a comment
There was a problem hiding this comment.
Changes look good, except one question:
| androidx-car = { module = "androidx.car.app:app", version.ref = "androidx-car"} | ||
| androidx-compose-animation-graphics = { module = "androidx.compose.animation:animation-graphics", version.ref = "compose-latest" } | ||
| androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" } | ||
| androidx-compose-bom = { module = "androidx.compose:compose-bom-alpha", version.ref = "androidx-compose-bom" } |
There was a problem hiding this comment.
is it okay move the whole repo to alpha?
There was a problem hiding this comment.
@kkuan2011 no, will leave this as a branch until we are good to go with a stable version :)
There was a problem hiding this comment.
ok sounds good :) I'll assume no action needed for now then
No description provided.