Skip to content

Commit b91d61f

Browse files
authored
Limit toast expanded width to 400 points (#4246)
Introduces a maxToastWidth constant to cap the expanded width of the toast view at 400 points, ensuring it does not exceed this value regardless of screen size. <!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. -->
1 parent 0553c44 commit b91d61f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Shared/Toast/DynamicIslandToast/ToastView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public struct ToastView: View {
9696
let topOffset: CGFloat = 11 + max(safeArea.top - 59, 0)
9797

9898
/// Expanded Properties
99-
let expandedWidth = size.width - 20
99+
let maxToastWidth: CGFloat = 400
100+
let expandedWidth = min(size.width - 20, maxToastWidth)
100101
let expandedHeight: CGFloat = haveDynamicIsland ? 90 : 70
101102
let scaleX: CGFloat = isExpanded ? 1 : (dynamicIslandWidth / expandedWidth)
102103
let scaleY: CGFloat = isExpanded ? 1 : (dynamicIslandHeight / expandedHeight)

0 commit comments

Comments
 (0)