Skip to content

Conversation

@bgoncal
Copy link
Member

@bgoncal bgoncal commented Jan 29, 2026

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@bgoncal bgoncal self-assigned this Jan 29, 2026
Copilot AI review requested due to automatic review settings January 29, 2026 14:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines widget layout handling by wiring the WidgetFamily into SwiftUI previews and the widget creation UI, and updates snapshots for the systemSmall “withoutSubtitleWithIconBackground” configuration.

Changes:

  • Added WidgetKit import and @Environment(\.widgetFamily) usage support in WidgetBasicView, and propagated explicit widgetFamily values through various previews.
  • Introduced a (problematic) custom EnvironmentKey/EnvironmentValues pair for WidgetFamily and used it in widget previews and the widget creation view.
  • Regenerated snapshot PNGs for the systemSmall “withoutSubtitleWithIconBackground” widget in light and dark modes.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/Widgets/Snapshots/WidgetsSnapshot.test/systemSmallSnapshots.withoutSubtitleWithIconBackground-systemSmall-02_tiles-light.png Updated light-mode snapshot for the systemSmall widget without subtitle and with icon background to match the new layout.
Tests/Widgets/Snapshots/WidgetsSnapshot.test/systemSmallSnapshots.withoutSubtitleWithIconBackground-systemSmall-02_tiles-dark.png Updated dark-mode snapshot for the same widget configuration to reflect the revised rendering.
Sources/Extensions/Widgets/Common/WidgetBasicView.swift Imports WidgetKit so the view can use @Environment(\.widgetFamily) and adjust layout (e.g., spacing/height) based on the widget family.
Sources/Extensions/Widgets/Common/WidgetBasicContainerView.swift Adds a retroactive EnvironmentKey conformance on WidgetFamily, defines a widgetFamily environment value, and sets it in widget previews for different WidgetFamily sizes.
Sources/App/Settings/Widgets/Builder/WidgetCreationView.swift Injects a widgetFamily environment value into the widget preview used in the widget creation UI so WidgetBasicView can size itself correctly.

@bgoncal bgoncal enabled auto-merge (squash) January 29, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants