Fix lint UnnecessaryComposedModifier and make it an error
This commit is contained in:
parent
4a63847245
commit
5964591a19
2 changed files with 5 additions and 3 deletions
|
|
@ -21,7 +21,6 @@ import android.os.Build
|
||||||
import androidx.annotation.ChecksSdkIntAtLeast
|
import androidx.annotation.ChecksSdkIntAtLeast
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.composed
|
|
||||||
import androidx.compose.ui.draw.BlurredEdgeTreatment
|
import androidx.compose.ui.draw.BlurredEdgeTreatment
|
||||||
import androidx.compose.ui.draw.blur
|
import androidx.compose.ui.draw.blur
|
||||||
import androidx.compose.ui.draw.drawBehind
|
import androidx.compose.ui.draw.drawBehind
|
||||||
|
|
@ -94,8 +93,8 @@ fun Modifier.blurredShapeShadow(
|
||||||
fun Modifier.blurCompat(
|
fun Modifier.blurCompat(
|
||||||
radius: Dp,
|
radius: Dp,
|
||||||
edgeTreatment: BlurredEdgeTreatment = BlurredEdgeTreatment.Rectangle
|
edgeTreatment: BlurredEdgeTreatment = BlurredEdgeTreatment.Rectangle
|
||||||
): Modifier = composed {
|
): Modifier {
|
||||||
when {
|
return when {
|
||||||
radius.value == 0f -> this
|
radius.value == 0f -> this
|
||||||
canUseBlur() -> blur(radius, edgeTreatment)
|
canUseBlur() -> blur(radius, edgeTreatment)
|
||||||
else -> this // Added in case we find a way to make this work on older devices
|
else -> this // Added in case we find a way to make this work on older devices
|
||||||
|
|
|
||||||
|
|
@ -124,4 +124,7 @@
|
||||||
|
|
||||||
<!-- DI -->
|
<!-- DI -->
|
||||||
<!-- issue id="JvmStaticProvidesInObjectDetector" severity="error" /-->
|
<!-- issue id="JvmStaticProvidesInObjectDetector" severity="error" /-->
|
||||||
|
|
||||||
|
<!-- Compose -->
|
||||||
|
<issue id="UnnecessaryComposedModifier" severity="error" />
|
||||||
</lint>
|
</lint>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue