Addition of size calculation for Label placed in Popup and correction of size calculation when Popup Size is not specified #1456
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.
This PR will correct the following:
Description of Change
Below is the first change.
[src\CommunityToolkit.Maui.Core\Views\Popup\PopupExtensions.android.cs]
It has been reported in .NET MAUI Issue #2019 that on Android, VerticalTextAlignment and HorizontalTextAlignment do not work when Fill is specified for LayoutAlignment.
In PR #2059, the issue is resolved by calling the Measure method with MeasureSpecMode.Exactly specified as the Measure method argument. To accomplish the same thing, I defined a new Measure method and called it.
Below is the second change.
[src\CommunityToolkit.Maui.Core\Views\Popup\PopupExtensions.android.cs]
[src\CommunityToolkit.Maui.Core\Views\Popup\PopupExtensions.macios.cs]
[src\CommunityToolkit.Maui.Core\Views\Popup\PopupExtensions.windows.cs]
Fixed the width and height passed when calling the Measure method when the Popup size is unspecified.
If the Popup size is unspecified and the Popup Content Size is unspecified, the screen size is passed. If the Popup size is unspecified and the Popup Content size is specified, the Popup Content size is passed. I have modified it as follows.
Linked Issues
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
Below are the verification results for the first modification.
I tested it with the following layout.
These are the execution results for each platform.
You can see that the Popup is displayed as expected on all platforms.
Below are the verification results for the second modification.
I tested it with the following layout.
These are the execution results for each platform.
Android.Emulator.-.pixel_2_-_api_30_5554.2023-10-13.15-35-33.mp4
iPhone.14.iOS.16.4.2023-10-13.15-30-07.mp4
2023-10-13.15-38-14.mp4
I tested it with the following layout.
These are the execution results for each platform.
Android.Emulator.-.pixel_2_-_api_30_5554.2023-10-13.15-43-52.mp4
iPhone.14.iOS.16.4.2023-10-13.15-46-39.mp4
2023-10-13.15-41-45.mp4
You can see that the Popup is displayed as expected on all platforms.
Finally, the results of verification that there is no impact on PRs created so far are shown below.
I tested it with the following layout. [Confirm Issue #1423]
These are the execution results for each platform.
I tested it with the following layout. [Confirm Issue #1353]
These are the execution results for each platform.
I tested it with the following layout. [Confirm PR #1361]
These are the execution results for each platform.
Android.Emulator.-.pixel_2_-_api_30_5554.2023-10-13.16-31-44.mp4
iPhone.14.iOS.16.4.2023-10-13.16-29-04.mp4
2023-10-13.16-34-15.mp4
You can see that the Popup is displayed as expected on all platforms.