Blueprint icon indicating copy to clipboard operation
Blueprint copied to clipboard

Secondary elements

Open watt opened this issue 6 years ago • 2 comments

SwiftUI has a concept of secondary views, which are attached to a parent view but do not play a part in layout. Handy for e.g. putting a badge on an icon without changing the layout of the icon.

This can almost be replicated in Blueprint with Overlays, but really needs custom layout in order to let the secondary element take any size or position without affecting the parent element. Blueprint should provide a dedicated element for this pattern.

watt avatar Jan 22 '20 01:01 watt

Could you sketch what you imagine this API looks like?

bencochran avatar Jan 22 '20 01:01 bencochran

Oops, forgot to respond to this. I imagine a wrapper that simply takes two elements, and "attaches" the second to the first.

Attached(
    element: primaryElement,
    attachment: secondaryElement
)

Here primaryElement is wrapped and laid out normally, and secondaryElement is overlaid, but unlike Overlay, the layout of secondaryElement can not affect primaryElement or the Attached element.

watt avatar Mar 13 '20 21:03 watt