Skip to content

Commit

Permalink
bug: Make Shapes private and use them from CustomShapes
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Oct 16, 2024
1 parent 6cfa026 commit f9595f9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
import com.infomaniak.swisstransfer.ui.images.icons.Add
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme

@Composable
Expand Down Expand Up @@ -73,7 +73,7 @@ private fun CoreButton(
Button(
modifier = modifier.height(buttonSize.height),
colors = style.buttonColors(),
shape = Shapes.medium,
shape = CustomShapes.medium,
enabled = enabled,
onClick = onClick,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ import com.infomaniak.library.filetypes.FileType
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages
import com.infomaniak.swisstransfer.ui.images.icons.CrossThick
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.LocalIsDarkMode
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow
Expand Down Expand Up @@ -104,7 +104,7 @@ private fun FileItemContent(
onClick = onClick,
modifier = Modifier.aspectRatio(164 / 152f),
colors = CardDefaults.cardColors(containerColor = SwissTransferTheme.materialColors.background),
shape = Shapes.small,
shape = CustomShapes.small,
border = BorderStroke(width = 1.dp, SwissTransferTheme.materialColors.outlineVariant)
) {
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
import com.infomaniak.swisstransfer.ui.images.icons.Add
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme

@Composable
Expand All @@ -62,8 +62,8 @@ fun SwissTransferFab(
}

enum class FabType(val shape: CornerBasedShape, val customSize: Dp?) {
NORMAL(Shapes.medium, null),
BIG(Shapes.large, 80.dp),
NORMAL(CustomShapes.medium, null),
BIG(CustomShapes.large, 80.dp),
}

@Preview(name = "Light mode")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
package com.infomaniak.swisstransfer.ui.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.unit.dp

object CustomShapes {
val None = RoundedCornerShape(0)
val Rounded = RoundedCornerShape(50)
val extraSmall = RoundedCornerShape(4.dp)
val small = RoundedCornerShape(8.dp)
val medium = RoundedCornerShape(16.dp)
val large = RoundedCornerShape(24.dp)
}
30 changes: 0 additions & 30 deletions app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Shapes.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Shapes
import androidx.compose.material3.adaptive.WindowAdaptiveInfo
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.runtime.*
Expand Down Expand Up @@ -85,3 +86,11 @@ data class CustomColorScheme(
val transferTypeProximityContainer: Color = Color.Unspecified,
val transferTypeProximityOnContainer: Color = Color.Unspecified,
)

private val Shapes = Shapes(
extraSmall = CustomShapes.extraSmall,
small = CustomShapes.small,
medium = CustomShapes.medium,
large = CustomShapes.large,
// extraLarge: uses default values, for the bottom sheet corners
)

0 comments on commit f9595f9

Please sign in to comment.