Skip to content

Mesh Gradients in Compose 1.12#936

Open
riggaroo wants to merge 7 commits into
mainfrom
feature/mesh-gradients
Open

Mesh Gradients in Compose 1.12#936
riggaroo wants to merge 7 commits into
mainfrom
feature/mesh-gradients

Conversation

@riggaroo

@riggaroo riggaroo commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

riggaroo added 4 commits May 29, 2026 15:00
* 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.
@riggaroo riggaroo requested review from a team, kkuan2011 and yrezgui as code owners June 4, 2026 09:49
@snippet-bot

snippet-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
val gradientPainter = remember {
val gradientPainter = remember(animatedOffset) {

@kkuan2011 kkuan2011 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, except one question:

Comment thread gradle/libs.versions.toml
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" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it okay move the whole repo to alpha?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kkuan2011 no, will leave this as a branch until we are good to go with a stable version :)

@kkuan2011 kkuan2011 Jun 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sounds good :) I'll assume no action needed for now then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants