Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ enum class FlintButtonState() {
get() = BorderStroke(2.dp, FlintTheme.colors.primary400)
},

Error {
override val background: Brush
@Composable
@ReadOnlyComposable
get() = SolidColor(FlintTheme.colors.gray800)

override val contentColor: Color
@Composable
@ReadOnlyComposable
get() = FlintTheme.colors.white

override val border: BorderStroke
@Composable
@ReadOnlyComposable
get() = BorderStroke(2.dp, FlintTheme.colors.error500)
},

Destructive {
override val background: Brush
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fun CollectionInputTextField(
maxLines: Int,
isShowLengthTitle: Boolean,
modifier: Modifier = Modifier,
isError: Boolean = false,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default
) {
Expand All @@ -48,6 +49,7 @@ fun CollectionInputTextField(
maxLength = maxLength,
singleLine = singleLine,
maxLines = maxLines,
isError = isError,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
paddingValues = PaddingValues(horizontal = 12.dp, vertical = 10.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fun FlintBasicTextField(
textStyle: TextStyle = FlintTheme.typography.body1R16,
backgroundColor: Color = FlintTheme.colors.gray800,
borderColor: Color = Color.Unspecified,
isError: Boolean = false,
paddingValues: PaddingValues = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
Expand All @@ -65,8 +66,8 @@ fun FlintBasicTextField(
.clip(RoundedCornerShape(radius))
.background(backgroundColor)
.border(
width = 1.dp,
color = borderColor,
width = if (isError) 2.dp else 1.dp,
color = if (isError) FlintTheme.colors.error500 else borderColor,
shape = RoundedCornerShape(radius),
)
.clickable(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.flint.core.designsystem.component.toast

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.isImeVisible
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -23,19 +26,24 @@ import com.flint.core.designsystem.theme.FlintTheme
import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.seconds

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun ShowToast(
text: String,
imageVector: ImageVector?,
paddingValues: PaddingValues,
yOffset: Dp,
hide: () -> Unit,
imeYOffset: Dp = yOffset,
key: Any = text,
) {
LaunchedEffect(Unit) {
LaunchedEffect(key) {
delay(2.seconds)
hide()
}

val bottomOffset = if (WindowInsets.isImeVisible) imeYOffset else yOffset

Box(
modifier = Modifier
.fillMaxSize()
Expand All @@ -47,7 +55,7 @@ fun ShowToast(
imageVector = imageVector,
modifier = Modifier
.padding(paddingValues)
.padding(bottom = yOffset),
.padding(bottom = bottomOffset),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ data class Colors(
val gray900: Color,
val white: Color,
val background: Color,
val subBackground: Color,
val error200: Color,
val error500: Color,
val error700: Color,
Expand Down Expand Up @@ -119,6 +120,7 @@ val FlintColors =
gray900 = Color(0xFF151821),
white = Color(0xFFFFFFFF),
background = Color(0xFF121212),
subBackground = Color(0xFF18191B),
error200 = Color(0xFFFFD7DB),
error500 = Color(0xFFFF4D62),
error700 = Color(0xFFB53746),
Expand Down Expand Up @@ -405,6 +407,11 @@ private fun FlintColorsPreview() {
.background(color = FlintColors.background)
.size(100.dp),
)
Box(
Modifier
.background(color = FlintColors.subBackground)
.size(100.dp),
)
Box(
Modifier
.background(color = FlintColors.error200)
Expand Down
Loading
Loading