-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [ANDROAPP-5890] add shadow to Listcards and samples to ListCard…
… screen (#183) * feat: [ANDROAPP-5890] add shadow to Listcards and samples to ListCard screen * feat: [ANDROAPP-5890] refactor parameter names
- Loading branch information
1 parent
6f7cd7b
commit db6b670
Showing
6 changed files
with
152 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
34 changes: 34 additions & 0 deletions
34
...ystem/src/androidMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Shadow.android.kt
This file contains 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,34 @@ | ||
package org.hisp.dhis.mobile.ui.designsystem.theme | ||
|
||
import android.graphics.BlurMaskFilter | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.drawBehind | ||
import androidx.compose.ui.graphics.Paint | ||
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas | ||
import androidx.compose.ui.graphics.toArgb | ||
|
||
internal actual fun Modifier.listCardShadow(modifier: Modifier): Modifier = this.then( | ||
drawBehind { | ||
drawIntoCanvas { canvas -> | ||
val paint = Paint() | ||
val frameworkPaint = paint.asFrameworkPaint() | ||
|
||
frameworkPaint.maskFilter = (BlurMaskFilter(Spacing.Spacing10.toPx(), BlurMaskFilter.Blur.NORMAL)) | ||
|
||
frameworkPaint.color = SurfaceColor.Container.toArgb() | ||
|
||
val leftPixel = Spacing.Spacing0.toPx() | ||
val topPixel = Spacing.Spacing4.toPx() | ||
val rightPixel = size.width + topPixel | ||
val bottomPixel = size.height + leftPixel | ||
|
||
canvas.drawRect( | ||
left = leftPixel, | ||
top = topPixel, | ||
right = rightPixel, | ||
bottom = bottomPixel, | ||
paint = paint, | ||
) | ||
} | ||
}, | ||
) |
This file contains 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
This file contains 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
9 changes: 9 additions & 0 deletions
9
...ystem/src/desktopMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Shadow.desktop.kt
This file contains 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,9 @@ | ||
package org.hisp.dhis.mobile.ui.designsystem.theme | ||
|
||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.shadow | ||
|
||
internal actual fun Modifier.listCardShadow(modifier: Modifier): Modifier = this.then( | ||
modifier.shadow(elevation = Spacing.Spacing10, shape = RoundedCornerShape(Radius.S), spotColor = SurfaceColor.Container), | ||
) |