Skip to content

Conversation

@SubhikshaSf4851
Copy link
Contributor

@SubhikshaSf4851 SubhikshaSf4851 commented Oct 22, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

RootCause

The gradient didn’t update after layout changes because its offsets weren’t recalculated when the view’s layout changed. Solid colors weren’t affected since they don’t depend on offsets.

Description of Change

Ensured the background is redrawn on every layout change by calling UpdateBackground() in ViewWillLayoutSubviews instead of only in ViewDidLoad in ShellFlyoutContentRenderer.cs, fixing gradient rendering issues.

Issues Fixed

Fixes #27822

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix
WithoutFixIssue27822.mp4
Untitled.4.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 22, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 22, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@jsuarezruiz jsuarezruiz added the area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing label Oct 22, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

App.Tap("navigateButton");
App.WaitForElement("welcomeLabel");
App.SetOrientationPortrait();
VerifyScreenshot();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running a build, pending snapshots.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the snapshots

UpdateFooterPosition();
UpdateFlyoutContent();
// Whenever the layout changes, the background needs to be redrawn to match the new view dimensions. This is especially important for gradients.
UpdateBackground();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think UpdateBackground() will be called too frequently.

ViewWillLayoutSubviews() is called many times:

  • Initial layout
  • Orientation change
  • Keyboard appearance
  • Safe area inset changes
  • Parent view layout changes

Can only redraw when size actually changes?

var currentSize = View.Bounds.Size;
if (_lastBackgroundSize != currentSize)
     UpdateBackground();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have modified the changes

@SubhikshaSf4851 SubhikshaSf4851 marked this pull request as ready for review October 23, 2025 13:26
Copilot AI review requested due to automatic review settings October 23, 2025 13:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a rendering issue where LinearGradientBrush in Shell FlyoutBackground was misaligned on iOS after layout changes, particularly during device orientation changes. The gradient wasn't updating because its offsets weren't recalculated when the view's layout changed.

Key Changes:

  • Moved background update logic from ViewDidLoad to ViewWillLayoutSubviews with bounds checking
  • Added UI test to verify gradient rendering persists through orientation changes

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

File Description
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellFlyoutContentRenderer.cs Moved UpdateBackground() call from ViewDidLoad to ViewWillLayoutSubviews with bounds tracking to redraw gradient on layout changes
src/Controls/tests/TestCases.HostApp/Issues/Issue27822.cs Added test page demonstrating the gradient background issue in Shell flyout
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27822.cs Added automated UI test that verifies gradient rendering after orientation change

Comment on lines +230 to +236
var currentSize = View.Bounds.Size;
if (_previousBounds != currentSize)
{
// Whenever the layout changes, the background needs to be redrawn to match the new view dimensions. This is especially important for gradients.
UpdateBackground();
_previousBounds = currentSize;
}
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The background is redrawn on every layout change, which could be called multiple times during animations or layout passes. Consider adding a small tolerance check or debouncing to avoid unnecessary redraws during minor layout adjustments.

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios shell-flyout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] LinearGradientBrush in Shell.FlyoutBackground sometimes misaligned/not calculated correctly

3 participants