Skip to content

Commit 3d9d1ab

Browse files
CopilotNirmalKumarYuvarajPureWeen
authored
Fix AppBarLayout insets when FlyoutPage is pushed modally on Android (#32379)
* Initial plan * Fix FlyoutPage modal AppBarLayout inset issue by enhancing recursive search Co-authored-by: NirmalKumarYuvaraj <[email protected]> # Conflicts: # src/Core/src/Platform/Android/GlobalWindowInsetListener.cs * Apply code formatting to GlobalWindowInsetListener and test Co-authored-by: NirmalKumarYuvaraj <[email protected]> * Address code review feedback: use named constant and proper using statement Co-authored-by: NirmalKumarYuvaraj <[email protected]> * Replace DeviceTest with UI Test for Issue32277 Co-authored-by: NirmalKumarYuvaraj <[email protected]> * Use VerifyScreenshot() instead of WaitForElement for visual verification Co-authored-by: NirmalKumarYuvaraj <[email protected]> * added pending snapshots * - fixed UItest to reproduce the problem --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: NirmalKumarYuvaraj <[email protected]> Co-authored-by: Shane Neuville <[email protected]>
1 parent cd46478 commit 3d9d1ab

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed
9.91 KB
Loading
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
namespace Maui.Controls.Sample.Issues;
2+
3+
[Issue(IssueTracker.Github, 32277, "When a FlyoutPage is pushed Modally it doesn't inset the AppBarLayout", PlatformAffected.Android)]
4+
public partial class Issue32277 : NavigationPage
5+
{
6+
public Issue32277()
7+
{
8+
PushAsync(new Issue32277_ContentPage());
9+
}
10+
}
11+
12+
public class Issue32277_ContentPage : ContentPage
13+
{
14+
public Issue32277_ContentPage()
15+
{
16+
Title = "Issue 32277";
17+
18+
Button button = new Button
19+
{
20+
Text = "Push Modal Flyout Page",
21+
AutomationId = "PushModalFlyoutButton"
22+
};
23+
button.Clicked += async (s, e) =>
24+
{
25+
await Navigation.PushModalAsync(new Issue32277_FlyoutPage());
26+
};
27+
Content = new StackLayout
28+
{
29+
Children =
30+
{
31+
button
32+
}
33+
};
34+
}
35+
}
36+
37+
public class Issue32277_FlyoutPage : FlyoutPage
38+
{
39+
public Issue32277_FlyoutPage()
40+
{
41+
Flyout = new ContentPage
42+
{
43+
Title = "Flyout",
44+
Content = new StackLayout
45+
{
46+
Children =
47+
{
48+
new Label
49+
{
50+
Text = "This is the flyout page.",
51+
AutomationId = "FlyoutLabel"
52+
}
53+
}
54+
}
55+
};
56+
57+
Detail = new NavigationPage(new ContentPage
58+
{
59+
Title = "Detail",
60+
Content = new StackLayout
61+
{
62+
Children =
63+
{
64+
new Label
65+
{
66+
Text = "This is the detail page.",
67+
AutomationId = "DetailLabel"
68+
}
69+
}
70+
}
71+
});
72+
}
73+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#if ANDROID || IOS // Exclude desktop platforms (Windows, MacCatalyst)
2+
using NUnit.Framework;
3+
using UITest.Appium;
4+
using UITest.Core;
5+
6+
namespace Microsoft.Maui.TestCases.Tests.Issues;
7+
8+
public class Issue32277 : _IssuesUITest
9+
{
10+
public Issue32277(TestDevice device) : base(device)
11+
{
12+
}
13+
14+
public override string Issue => "When a FlyoutPage is pushed Modally it doesn't inset the AppBarLayout";
15+
16+
[Test]
17+
[Category(UITestCategories.FlyoutPage)]
18+
public void FlyoutPageModalAppBarLayoutGetsInsets()
19+
{
20+
// Tap the button to push the FlyoutPage modally
21+
App.WaitForElement("PushModalFlyoutButton");
22+
App.Tap("PushModalFlyoutButton");
23+
24+
// Wait for the modal FlyoutPage to appear
25+
App.WaitForElement("DetailLabel");
26+
27+
// Verify the detail page is visible and properly positioned
28+
// If the AppBarLayout insets are not applied correctly, the navigation bar
29+
// would render behind system UI elements
30+
VerifyScreenshot();
31+
}
32+
}
33+
#endif
23.6 KB
Loading

0 commit comments

Comments
 (0)