Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What has happened?
There were cases, when selection view was not aligned appropriately at first appearance. For example, when SegmentedPicker was embedded into NavigationView and selection view itself was something like:
Actually, there are two issues:
2 Incorrect selection view size
Both occured at first rendering of selection view in different alignment positions and could be cured by selecting and re-selecting different items.
Solution
1. Incorrect selection view alignment
New parameter -
selectionAlignment
ofVerticalAlignment
type was introduced.It allows to specify exactly how the selection view should be vertically aligned to segment content items and fixes unwanted jumps of the selection view.
Default value is
VerticalAlignment.center
which is recommended config for capsule-style selection.However, for underline-style selections,
VerticalAlignment.bottom
is recommended.(See the Readme for example)
2. Incorrect selection view size
This is another first-render type of issues.
The way we get content view sizes with geometry reader doesn't seems to be 100% exact.
I don't see any workarounds here other than to trigger segment view re-selection to get the correct appearance.
(See the Readme for example)