Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit f25aad8

Browse files
codeman7material-automation
authored andcommitted
#Buttons Add shadow to visual background
PiperOrigin-RevId: 754957294
1 parent 4badc9d commit f25aad8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

components/M3CButton/src/M3CButton.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ - (void)setButtonSize:(M3CButtonSize)buttonSize {
129129
[self updateCorners];
130130
[self updateFont];
131131
[self updateSymbolFont];
132+
[self updateShadows];
132133
}
133134

134135
// Colors
@@ -302,7 +303,17 @@ - (void)updateShadows {
302303
radius:shadow.radius
303304
offset:shadow.offset
304305
spread:shadow.spread] build];
305-
MDCConfigureShadowForView(self, shadow);
306+
if (_buttonSizeSet) {
307+
MDCShadow *emptyShadow = [[MDCShadowBuilder builderWithColor:UIColor.clearColor
308+
opacity:0
309+
radius:0
310+
offset:CGSizeZero
311+
spread:0] build];
312+
MDCConfigureShadowForView(self, emptyShadow);
313+
MDCConfigureShadowForView(self.visualBackground, shadow);
314+
} else {
315+
MDCConfigureShadowForView(self, shadow);
316+
}
306317
}
307318

308319
- (void)setImageEdgeInsetsWithImageAndTitle:(UIEdgeInsets)imageEdgeInsetsWithImageAndTitle

0 commit comments

Comments
 (0)