Created
March 5, 2021 05:50
-
-
Save yaraki/7c7e9b3cc146d375cb6b1cc75fe778cd to your computer and use it in GitHub Desktop.
Common interface for Spacers in Column and Row
This file contains 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
package com.example.android.codelab.animationdemo.ui | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.ColumnScope | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.RowScope | |
import androidx.compose.foundation.layout.Spacer | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.layout.width | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.unit.Dp | |
import androidx.compose.ui.unit.dp | |
@Composable | |
fun ColumnScope.Gap(height: Dp) = Spacer(modifier = Modifier.height(height)) | |
@Composable | |
fun RowScope.Gap(width: Dp) = Spacer(modifier = Modifier.width(width)) | |
@Composable | |
fun Usage() { | |
Column { | |
Text("A") | |
Gap(8.dp) | |
Text("B") | |
Gap(8.dp) | |
Row { | |
Text("C") | |
Gap(24.dp) | |
Text("D") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment