Add HAFloatingActionButton component#7204
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a reusable HAFloatingActionButton Compose component in :common so features (e.g., Shortcuts V2) can share a Home Assistant–themed FAB implementation and validate its visuals via screenshot tests.
Changes:
- Added
HAFloatingActionButtoncomponent withButtonVariant-driven color theming viaLocalHAColorScheme. - Added a light/dark screenshot test that renders the FAB across all
ButtonVariantvalues. - Included a preview for quick local inspection of the component.
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| common/src/main/kotlin/io/homeassistant/companion/android/common/compose/composable/HAFloatingActionButton.kt | Adds the new HA-themed FAB composable + preview. |
| common/src/screenshotTest/kotlin/io/homeassistant/companion/android/compose/composable/HAFloatingActionButtonScreenshotTest.kt | Adds screenshot coverage for the FAB across variants in light/dark. |
66a1fcf to
7b71946
Compare
| onClick: () -> Unit, | ||
| contentDescription: String?, | ||
| modifier: Modifier = Modifier, | ||
| variant: ButtonVariant = ButtonVariant.PRIMARY, |
There was a problem hiding this comment.
We probably should not have all variants for this one, but just follow what other components do. If we want to keep it primary only, I can make an update.
| FloatingActionButton( | ||
| onClick = onClick, | ||
| modifier = modifier.size(ButtonSize.LARGE.value), | ||
| shape = CircleShape, |
There was a problem hiding this comment.
I'm hardcoding this one for consistency. If we give too much freedom, it might end up inconsistent across multiple features. Still, if we think it's worth moving up, we can do that.
There was a problem hiding this comment.
I think there is room for some discussion on what the FAB shape should be. M3 default is square with rounded corners, not a circle. I don't know if the HA product design team has any plans with this, @TimoPtr can you ask?
Summary
As part of the Shortcuts V2 work we're building, we added a reusable HAFloatingActionButton component so it can be shared across features.
Checklist
Screenshots
Link to pull request in documentation repositories
User Documentation: home-assistant/companion.home-assistant#
Developer Documentation: home-assistant/developers.home-assistant#
Any other notes