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 @@ -9,18 +9,15 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewWrapper
import androidx.compose.ui.tooling.preview.PreviewWrapperProvider
import com.getcode.animation.LocalSharedTransitionScope
import com.flipcash.app.theme.internal.Flipcash2DesignSystem
import com.flipcash.app.theme.internal.FlipcashLegacyDesignSystem
import com.getcode.theme.CodeTheme

@Deprecated("Use FlipcashThemeWrapper")
@Composable
fun FlipcashPreview(
showBackground: Boolean = false,
useLegacyColors: Boolean = false,
content: @Composable () -> Unit
) {
val previewContent = @Composable {
Expand All @@ -39,11 +36,7 @@ fun FlipcashPreview(
}
}

if (useLegacyColors) {
FlipcashLegacyDesignSystem(previewContent)
} else {
Flipcash2DesignSystem(previewContent)
}
Flipcash2DesignSystem(previewContent)
}

class FlipcashThemeWrapper: PreviewWrapperProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ package com.flipcash.app.theme

import androidx.compose.runtime.Composable
import com.flipcash.app.theme.internal.Flipcash2DesignSystem
import com.flipcash.app.theme.internal.FlipcashLegacyDesignSystem

@Composable
fun FlipcashTheme(
useLegacyColors: Boolean = false,
content: @Composable () -> Unit,
) {
if (useLegacyColors) {
FlipcashLegacyDesignSystem(content)
} else {
Flipcash2DesignSystem(content)
}
Flipcash2DesignSystem(content)
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ object Flipcash2ColorSpec {
borderColor = null,
borderWidth = 0f,
)
val contactAvatar = GradientSpec(
background = Color.Black,
colors = listOf(
Color(0xFF414141),
Color(0xFF202020)
),
stops = listOf(0f, 1f)
)
}

private val colors = with(Flipcash2ColorSpec) {
Expand Down Expand Up @@ -94,7 +102,8 @@ private val colors = with(Flipcash2ColorSpec) {
bannerWarning = Warning,
bannerSuccess = BannerSuccess,
scrim = Black40,
accessKey = accessKey
accessKey = accessKey,
contactAvatar = contactAvatar,
)
}
@Composable
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ private fun <S : FlowStep, R : Parcelable> FlowHostImpl(
// We track what was seeded and only re-seed if the backstack is still untouched.
// Animation is suppressed during re-seed so NavDisplay doesn't slide between
// the stale and corrected content.
val seededStack = remember { initialStack.map { it::class } }
val currentInitialClasses = initialStack.map { it::class }
val seededStack = rememberSaveable { initialStack.map { it::class.qualifiedName } }
val currentInitialClasses = initialStack.map { it::class.qualifiedName }
val suppressTransition = remember { mutableStateOf(false) }
LaunchedEffect(currentInitialClasses) {
if (currentInitialClasses == seededStack) return@LaunchedEffect
val backstackClasses = innerBackStack.map { it::class }
val backstackClasses = innerBackStack.map { it::class.qualifiedName }
if (backstackClasses != seededStack) return@LaunchedEffect
suppressTransition.value = true
Snapshot.withMutableSnapshot {
Expand Down
9 changes: 9 additions & 0 deletions ui/theme/src/main/kotlin/com/getcode/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ val CodeAccessKey = GradientSpec(
stops = listOf(0f, 0.3f, 0.6f, 1f)
)

val CodeContactAvatar = GradientSpec(
background = Brand,
colors = listOf(
Color(0xFF4A5568),
Color(0xFF6B7A90),
),
stops = listOf(0f, 1f)
)

data class GradientSpec(
val background: Color,
val colors: List<Color>,
Expand Down
8 changes: 7 additions & 1 deletion ui/theme/src/main/kotlin/com/getcode/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ internal val CodeDefaultColorScheme = ColorScheme(
bannerSuccess = BannerSuccess,
scrim = Black40,
accessKey = CodeAccessKey,
contactAvatar = CodeContactAvatar,
)

@Composable
Expand Down Expand Up @@ -148,6 +149,7 @@ class ColorScheme(
bannerSuccess: Color,
scrim: Color,
accessKey: GradientSpec,
contactAvatar: GradientSpec,
) {
var brand by mutableStateOf(brand)
private set
Expand Down Expand Up @@ -230,6 +232,8 @@ class ColorScheme(

var accessKey by mutableStateOf(accessKey)
private set
var contactAvatar by mutableStateOf(contactAvatar)
private set


fun update(other: ColorScheme) {
Expand Down Expand Up @@ -272,6 +276,7 @@ class ColorScheme(
bannerSuccess = other.bannerSuccess
scrim = other.scrim
accessKey = other.accessKey
contactAvatar = other.contactAvatar
}

fun copy(): ColorScheme = ColorScheme(
Expand Down Expand Up @@ -314,6 +319,7 @@ class ColorScheme(
bannerSuccess = bannerSuccess,
scrim = scrim,
accessKey = accessKey,
contactAvatar = contactAvatar,
)
}

Expand Down Expand Up @@ -361,7 +367,7 @@ fun inputColors(
borderColor: Color = CodeTheme.colors.border,
unfocusedBorderColor: Color = borderColor,
backgroundColor: Color = White05,
placeholderColor: Color = CodeTheme.colors.textTertiary,
placeholderColor: Color = CodeTheme.colors.textSecondary,
cursorColor: Color = Color.White,
errorBorderColor: Color = CodeTheme.colors.error,
) = TextFieldDefaults.outlinedTextFieldColors(
Expand Down
Loading