This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public fun Modifier.centerInParent(): Modifier = | |
this then layout { measurable, constraints -> | |
val maxWidthAllowedByParent = constraints.maxWidth | |
val maxHeightAllowedByTheParent = constraints.maxHeight | |
val placeable = measurable.measure(constraints) | |
val start = maxWidthAllowedByParent / 2 - placeable.width / 2 | |
val top = maxHeightAllowedByTheParent / 2 - placeable.height / 2 | |
layout(width = placeable.width, height = placeable.height) { | |
placeable.placeRelative(x = start, y = top) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context(viewModel: ViewModel) | |
public fun <T> Flow<T>.stateInWhileSubscribed( | |
initialValue: T, | |
): StateFlow<T> = stateIn( | |
scope = viewModel.viewModelScope, | |
started = WhileSubscribed(stopTimeoutMillis = 5_000), | |
initialValue = initialValue, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.shape.CornerSize | |
import androidx.compose.foundation.shape.ZeroCornerSize | |
import androidx.compose.ui.unit.Dp | |
public sealed interface Corner { | |
public val cornerSize: CornerSize | |
public data class Concave(override val cornerSize: CornerSize) : Corner | |
public data class Rounded(override val cornerSize: CornerSize) : Corner | |
public data class Cut(override val cornerSize: CornerSize) : Corner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal val PIXEL_10_PRO_XL: DeviceConfig = | |
DeviceConfig( | |
screenHeight = 2992, | |
screenWidth = 1344, | |
xdpi = 486, | |
ydpi = 486, | |
orientation = ScreenOrientation.PORTRAIT, | |
uiMode = UiMode.NORMAL, | |
nightMode = NightMode.NOTNIGHT, | |
density = Density.create(560), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
@Preview( | |
group = "Light Theme - All Rounded Surface", | |
uiMode = Configuration.UI_MODE_NIGHT_NO, | |
) | |
@Preview( | |
group = "Dark Theme - All Rounded Surface", | |
uiMode = Configuration.UI_MODE_NIGHT_YES, | |
) | |
internal fun ListItemAllRoundedSurfacePreview( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class ListItemAllRoundedSurfaceContentProvider : | |
PreviewParameterProvider<ListItemPreviewViewState> { | |
override val values: Sequence<ListItemPreviewViewState> = | |
listItemContentProviderValues(AllRounded) | |
} | |
internal class ListItemTopRoundedSurfaceContentProvider : | |
PreviewParameterProvider<ListItemPreviewViewState> { | |
override val values: Sequence<ListItemPreviewViewState> = | |
listItemContentProviderValues(TopRounded) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
public fun ListItem( | |
modifier: Modifier = Modifier, | |
primaryText: String, | |
primaryTextStyle: ListItemPrimaryTextStyle = ListItemPrimaryTextStyle.Default, | |
primaryTextColor: ListItemPrimaryTextColor = ListItemPrimaryTextColor.OnSurfaceOrBackground, | |
primaryTextDecoration: TextDecoration? = null, | |
secondaryText: String? = null, | |
secondarySlot: @Composable (() -> Unit)? = null, | |
startIcon: ListItemStartIcon? = null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class EditVehicleAvailabilityPreviewParameterProvider : | |
PreviewParameterProvider<EditVehicleAvailabilityViewState> { | |
override val values: Sequence<EditVehicleAvailabilityViewState> = sequenceOf(loadedViewState()) | |
} | |
internal fun loadedViewState(): EditVehicleAvailabilityViewState = | |
EditVehicleAvailabilityViewState( | |
isLoading = false, | |
content = EditVehicleAvailabilityContentState( | |
title = ResId(ContentStringsR.motor_edit_availability_title), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
@LightDarkPreview | |
internal fun EditVehicleAvailabilityUi( | |
@PreviewParameter(EditVehicleAvailabilityPreviewParameterProvider::class) | |
state: EditVehicleAvailabilityViewState, | |
) { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public data class TextStyles( | |
val navigationTitle: TextStyle = Typography().h6.copy( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.W500, | |
fontStyle = FontStyle.Normal, | |
fontSize = 20.sp, | |
lineHeight = 22.sp, | |
letterSpacing = 0.26.sp, | |
), | |
(...) |
NewerOlder