File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
fluentui_core/src/main/java/com/microsoft/fluentui/theme/token/controlTokens
fluentui_notification/src/main/java/com/microsoft/fluentui/tokenized/notification Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import androidx.compose.ui.unit.dp
11
11
import com.microsoft.fluentui.theme.FluentTheme.aliasTokens
12
12
import com.microsoft.fluentui.theme.token.ControlInfo
13
13
import com.microsoft.fluentui.theme.token.FluentAliasTokens
14
+ import com.microsoft.fluentui.theme.token.FluentGlobalTokens
14
15
import com.microsoft.fluentui.theme.token.IControlToken
15
16
import kotlinx.parcelize.Parcelize
16
17
@@ -91,6 +92,17 @@ open class SnackBarTokens : IControlToken, Parcelable {
91
92
)
92
93
}
93
94
95
+ @Composable
96
+ open fun shadowElevationValue (snackBarInfo : SnackBarInfo ): Dp {
97
+ return when (snackBarInfo.style) {
98
+ SnackbarStyle .Neutral -> FluentGlobalTokens .ShadowTokens .Shadow02 .value
99
+ SnackbarStyle .Contrast -> FluentGlobalTokens .ShadowTokens .Shadow16 .value
100
+ SnackbarStyle .Accent -> FluentGlobalTokens .ShadowTokens .Shadow04 .value
101
+ SnackbarStyle .Warning -> FluentGlobalTokens .ShadowTokens .Shadow08 .value
102
+ SnackbarStyle .Danger -> FluentGlobalTokens .ShadowTokens .Shadow00 .value
103
+ }
104
+ }
105
+
94
106
@Composable
95
107
open fun leftIconSize (snackBarInfo : SnackBarInfo ): Dp = 24 .dp
96
108
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import androidx.compose.runtime.*
15
15
import androidx.compose.ui.Alignment
16
16
import androidx.compose.ui.Modifier
17
17
import androidx.compose.ui.draw.clip
18
+ import androidx.compose.ui.draw.shadow
18
19
import androidx.compose.ui.graphics.graphicsLayer
19
20
import androidx.compose.ui.input.pointer.pointerInput
20
21
import androidx.compose.ui.platform.LocalConfiguration
@@ -227,7 +228,7 @@ fun Snackbar(
227
228
bottom = 12 .dp,
228
229
end = 16 .dp
229
230
) else PaddingValues (start = 16 .dp, top = 12 .dp, bottom = 12 .dp)
230
-
231
+ val shadowElevationValue = token.shadowElevationValue(snackBarInfo)
231
232
NotificationContainer (
232
233
notificationMetadata = metadata,
233
234
hasIcon = metadata.icon != null ,
@@ -257,6 +258,10 @@ fun Snackbar(
257
258
.padding(horizontal = 16 .dp)
258
259
.defaultMinSize(minHeight = 52 .dp)
259
260
.fillMaxWidth()
261
+ .shadow(
262
+ elevation = shadowElevationValue,
263
+ shape = RoundedCornerShape (8 .dp)
264
+ )
260
265
.clip(RoundedCornerShape (8 .dp))
261
266
.background(token.backgroundBrush(snackBarInfo))
262
267
.semantics {
You can’t perform that action at this time.
0 commit comments