GradientFloatingActionButton: use gradientActionColors().
This commit is contained in:
parent
370300f810
commit
452489fbf1
1 changed files with 4 additions and 21 deletions
|
|
@ -37,12 +37,10 @@ import androidx.compose.ui.graphics.Shape
|
||||||
import androidx.compose.ui.graphics.graphicsLayer
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.compound.annotations.CoreColorToken
|
import io.element.android.compound.annotations.CoreColorToken
|
||||||
import io.element.android.compound.theme.ElementTheme
|
|
||||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||||
import io.element.android.compound.tokens.generated.internal.LightColorTokens
|
import io.element.android.libraries.designsystem.colors.gradientActionColors
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.LocalBuildMeta
|
|
||||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||||
|
|
||||||
@OptIn(CoreColorToken::class)
|
@OptIn(CoreColorToken::class)
|
||||||
|
|
@ -53,26 +51,14 @@ fun GradientFloatingActionButton(
|
||||||
shape: Shape = RoundedCornerShape(25),
|
shape: Shape = RoundedCornerShape(25),
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
val color1 = if (LocalBuildMeta.current.isEnterpriseBuild) {
|
val colors = gradientActionColors()
|
||||||
ElementTheme.colors.textActionAccent
|
|
||||||
} else {
|
|
||||||
LightColorTokens.colorGreen700
|
|
||||||
}
|
|
||||||
val color2 = if (LocalBuildMeta.current.isEnterpriseBuild) {
|
|
||||||
ElementTheme.colors.textActionAccent
|
|
||||||
} else {
|
|
||||||
LightColorTokens.colorBlue900
|
|
||||||
}
|
|
||||||
val linearShaderBrush = remember {
|
val linearShaderBrush = remember {
|
||||||
object : ShaderBrush() {
|
object : ShaderBrush() {
|
||||||
override fun createShader(size: Size): Shader {
|
override fun createShader(size: Size): Shader {
|
||||||
return LinearGradientShader(
|
return LinearGradientShader(
|
||||||
from = Offset(size.width, size.height),
|
from = Offset(size.width, size.height),
|
||||||
to = Offset(size.width, 0f),
|
to = Offset(size.width, 0f),
|
||||||
colors = listOf(
|
colors = colors,
|
||||||
color2,
|
|
||||||
color1,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -83,10 +69,7 @@ fun GradientFloatingActionButton(
|
||||||
return RadialGradientShader(
|
return RadialGradientShader(
|
||||||
center = size.center,
|
center = size.center,
|
||||||
radius = size.width / 2,
|
radius = size.width / 2,
|
||||||
colors = listOf(
|
colors = colors,
|
||||||
color1,
|
|
||||||
color2,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue