-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Fixed Button Shadow Color Transparency Not Applied Correctly #29371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PureWeen
merged 9 commits into
dotnet:inflight/current
from
NanthiniMahalingam:fix-29325
Jun 2, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
56ea05c
Fixed the shadow transparent issue on android
NanthiniMahalingam a5439c2
Updated the fix.
NanthiniMahalingam 5395951
Added the test case and updated the fix
NanthiniMahalingam 10ab96c
Added the output images.
NanthiniMahalingam d702917
Updated the fix.
NanthiniMahalingam 0f3d49d
Updated the comment.
NanthiniMahalingam 8c11156
Added the output images for mac and Windows
NanthiniMahalingam a17ae82
Updated the test case and added output images.
NanthiniMahalingam 5443fc4
Added the output images
NanthiniMahalingam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+108 KB
...ndroid.Tests/snapshots/android/ShouldUpdateButtonShadowWithTransparentColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 29325, "Button Shadow Color Transparency Not Applied Correctly", PlatformAffected.Android)] | ||
| public class Issue29325 : ContentPage | ||
| { | ||
| public Issue29325() | ||
| { | ||
| var verticalStackLayout = new VerticalStackLayout(); | ||
|
|
||
| var withoutAlphaOpacityButton = new Button | ||
| { | ||
| AutomationId = "withoutAlphaOpacityButton", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Text = "Button shadow color no Alpha nor opacity", | ||
| Shadow = new Shadow | ||
| { | ||
| Brush = Colors.Blue, | ||
| Offset = new Point(0, 12), | ||
| Radius = 12, | ||
| } | ||
| }; | ||
|
|
||
| var alphaButton = new Button | ||
| { | ||
| AutomationId = "alphaButton", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Text = "Button shadow color with Alpha", | ||
| Margin = new Thickness(0, 50, 0, 0), | ||
| Shadow = new Shadow | ||
| { | ||
| Brush = Colors.Blue.WithAlpha(0.4f), | ||
| Offset = new Point(0, 12), | ||
| Radius = 12, | ||
| } | ||
| }; | ||
|
|
||
| var opacityButton = new Button | ||
| { | ||
| AutomationId = "opacityButton", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Text = "Button shadow color with opacity", | ||
| Margin = new Thickness(0, 50, 0, 0), | ||
| Shadow = new Shadow | ||
| { | ||
| Brush = Colors.Blue, | ||
| Offset = new Point(0, 12), | ||
| Radius = 12, | ||
| Opacity = 0.4f | ||
| } | ||
| }; | ||
|
|
||
| var alphaOpacityButton = new Button | ||
| { | ||
| AutomationId = "alphaOpacityButton", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Text = "Button shadow color with alpha and opacity", | ||
| Margin = new Thickness(0, 50, 0, 0), | ||
| Shadow = new Shadow | ||
| { | ||
| Brush = Colors.Blue.WithAlpha(0.4f), | ||
| Offset = new Point(0, 12), | ||
| Radius = 12, | ||
| Opacity = 0.4f | ||
| } | ||
| }; | ||
|
|
||
| // Add the Button to the VerticalStackLayout | ||
| verticalStackLayout.Children.Add(withoutAlphaOpacityButton); | ||
| verticalStackLayout.Children.Add(alphaButton); | ||
| verticalStackLayout.Children.Add(opacityButton); | ||
| verticalStackLayout.Children.Add(alphaOpacityButton); | ||
|
|
||
| // Set the Content of the page | ||
| Content = verticalStackLayout; | ||
| } | ||
| } | ||
Binary file added
BIN
+26.1 KB
...tCases.Mac.Tests/snapshots/mac/ShouldUpdateButtonShadowWithTransparentColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29325.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue29325 : _IssuesUITest | ||
| { | ||
| public Issue29325(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Button Shadow Color Transparency Not Applied Correctly"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Button)] | ||
| public void ShouldUpdateButtonShadowWithTransparentColor() | ||
| { | ||
| App.WaitForElement("withoutAlphaOpacityButton"); | ||
| App.WaitForElement("alphaButton"); | ||
| App.WaitForElement("opacityButton"); | ||
| App.WaitForElement("alphaOpacityButton"); | ||
| VerifyScreenshot(); | ||
mattleibow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
Binary file added
BIN
+23.3 KB
....WinUI.Tests/snapshots/windows/ShouldUpdateButtonShadowWithTransparentColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+82.8 KB
...tCases.iOS.Tests/snapshots/ios/ShouldUpdateButtonShadowWithTransparentColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.