[iOS] Fixed ImageButton not honoring Padding value. #26785
Draft
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.
Issue Details
The ImageButton size calculation is incorrect. When an ImageButton has both padding and an image, its measured size does not adapt to include the padding values, causing the image to render smaller than expected.
Root Cause
The ImageButton DesiredSize is determined solely based on the ImageSize during the SizeThatFitsImage calculation. As a result, the ImageButton renders according to the image size alone, without accounting for the padding values in its measurement.
Description of Change
Updated the ImageButton to implement ICrossPlatformLayout for handling measurements, ensuring that content measurement accounts for padding values as expected, thereby improving the layout behavior.
Tested the behaviour in the following platforms
Issue Fixed
Fixes #22521
Output