Conversation
- Add `BaseText` and `BaseButton` components implementing `ExperimentalFoundationStyleApi` - Replace dummy style classes with official `androidx.compose.foundation.style` imports - Update `StylesSnippets.kt` to use the new `BaseText` and `BaseButton` implementations - Relocate style snippets to `designsystems.styles` package - Update `libs.versions.toml` to use `compose-bom-alpha` and remove explicit version overrides for core Compose libraries
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a comprehensive set of snippets demonstrating the new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a comprehensive set of snippets for the new Styles API in Jetpack Compose. The examples cover a wide range of use cases from basic styling to advanced animations and theme integration, which will be very helpful for developers.
I've found a couple of critical issues that would prevent compilation, specifically a function redeclaration and incorrect API usage in MyBaseButton. I've also pointed out a deprecated function call and a confusing snippet that could be improved.
After addressing these points, the snippets will be in great shape.
|
|
||
| // [START android_compose_styles_dos_wrapper] | ||
| @Composable | ||
| fun BaseButton( |
There was a problem hiding this comment.
The BaseButton composable is redeclared here, which conflicts with the BaseButton imported from com.example.compose.snippets.designsystems.styles.components.BaseButton (used throughout this file). This will cause a compilation error. Please rename this function to avoid the conflict, for example to BaseButtonSnippet.
| fun BaseButton( | |
| fun BaseButtonSnippet( |
| interactionSource = effectiveInteractionSource, | ||
| indication = null, | ||
| ) | ||
| .styleable(styleState, Style, style), // Assuming some base style |
There was a problem hiding this comment.
The styleable modifier expects Style objects as arguments. Here, Style is passed, which is a function reference, not a Style instance. This will cause a compilation error. To pass an empty base style, you should use Style(). The BaseButton in components/Button.kt uses a baseButtonStyle which is an empty style, so for consistency you could also define and use a similar empty base style here.
| .styleable(styleState, Style, style), // Assuming some base style | |
| .styleable(styleState, Style(), style), // Assuming some base style |
...e/snippets/src/main/java/com/example/compose/snippets/designsystems/styles/StylesSnippets.kt
Outdated
Show resolved
Hide resolved
| contentAlignment = Alignment.Center | ||
| ) { | ||
| BaseText( | ||
| "Button 19".toUpperCase(Locale.current), |
There was a problem hiding this comment.
The String.toUpperCase(Locale) function is deprecated. You should use the String.uppercase() extension function instead. It's recommended to provide a Locale to ensure consistent behavior across different user devices.
| "Button 19".toUpperCase(Locale.current), | |
| "Button 19".uppercase(Locale.current), |
…//github.com/android/snippets into dac-snippets-styles-documentation-2026-03-03
…//github.com/android/snippets into dac-snippets-styles-documentation-2026-03-03
…//github.com/android/snippets into dac-snippets-styles-documentation-2026-03-03
No description provided.