@@ -71,64 +71,62 @@ fun SuperButton(
7171 ButtonSize .Small -> PaddingValues (horizontal = 16 .dp, vertical = 5 .dp)
7272 }
7373 }
74- Box {
75- val isLightTheme = ElementTheme .isLightTheme
76- val colors = remember(isLightTheme) {
77- if (isLightTheme) {
78- listOf (
79- LightColorTokens .colorBlue900,
80- LightColorTokens .colorGreen1100,
81- )
82- } else {
83- listOf (
84- DarkColorTokens .colorBlue900,
85- DarkColorTokens .colorGreen1100,
86- )
87- }
74+ val isLightTheme = ElementTheme .isLightTheme
75+ val colors = remember(isLightTheme) {
76+ if (isLightTheme) {
77+ listOf (
78+ LightColorTokens .colorBlue900,
79+ LightColorTokens .colorGreen1100,
80+ )
81+ } else {
82+ listOf (
83+ DarkColorTokens .colorBlue900,
84+ DarkColorTokens .colorGreen1100,
85+ )
8886 }
87+ }
8988
90- val shaderBrush = remember(colors) {
91- object : ShaderBrush () {
92- override fun createShader (size : Size ): Shader {
93- return LinearGradientShader (
94- from = Offset (0f , size.height),
95- to = Offset (size.width, 0f ),
96- colors = colors,
97- )
98- }
89+ val shaderBrush = remember(colors) {
90+ object : ShaderBrush () {
91+ override fun createShader (size : Size ): Shader {
92+ return LinearGradientShader (
93+ from = Offset (0f , size.height),
94+ to = Offset (size.width, 0f ),
95+ colors = colors,
96+ )
9997 }
10098 }
101- val border = if (enabled) {
102- BorderStroke (1 .dp, shaderBrush)
103- } else {
104- BorderStroke (1 .dp, ElementTheme .colors.borderDisabled)
105- }
106- val backgroundColor = ElementTheme .colors.bgCanvasDefault
107- Box (
108- modifier = modifier
109- .minimumInteractiveComponentSize()
110- .graphicsLayer(shape = shape, clip = false )
111- .clip(shape)
112- .border(border, shape)
113- .drawBehind {
114- drawRect(backgroundColor)
115- drawRect(brush = shaderBrush, alpha = 0.04f )
116- }
117- .clickable(
118- enabled = enabled,
119- onClick = onClick,
120- interactionSource = remember { MutableInteractionSource () },
121- indication = rememberRipple()
122- )
123- .padding(contentPadding),
124- contentAlignment = Alignment .Center
125- ) {
126- CompositionLocalProvider (
127- LocalContentColor provides if (enabled) ElementTheme .colors.textPrimary else ElementTheme .colors.textDisabled,
128- LocalTextStyle provides ElementTheme .typography.fontBodyLgMedium,
129- ) {
130- content()
99+ }
100+ val border = if (enabled) {
101+ BorderStroke (1 .dp, shaderBrush)
102+ } else {
103+ BorderStroke (1 .dp, ElementTheme .colors.borderDisabled)
104+ }
105+ val backgroundColor = ElementTheme .colors.bgCanvasDefault
106+ Box (
107+ modifier = modifier
108+ .minimumInteractiveComponentSize()
109+ .graphicsLayer(shape = shape, clip = false )
110+ .clip(shape)
111+ .border(border, shape)
112+ .drawBehind {
113+ drawRect(backgroundColor)
114+ drawRect(brush = shaderBrush, alpha = 0.04f )
131115 }
116+ .clickable(
117+ enabled = enabled,
118+ onClick = onClick,
119+ interactionSource = remember { MutableInteractionSource () },
120+ indication = rememberRipple()
121+ )
122+ .padding(contentPadding),
123+ contentAlignment = Alignment .Center
124+ ) {
125+ CompositionLocalProvider (
126+ LocalContentColor provides if (enabled) ElementTheme .colors.textPrimary else ElementTheme .colors.textDisabled,
127+ LocalTextStyle provides ElementTheme .typography.fontBodyLgMedium,
128+ ) {
129+ content()
132130 }
133131 }
134132}
0 commit comments