Skip to content

Commit

Permalink
Merge pull request #544 from nimblehq/feature/543-add-default-spacing…
Browse files Browse the repository at this point in the history
…-dimensions

[#543] Add default spacing definition in app dimensions
  • Loading branch information
ryan-conway authored Oct 20, 2023
2 parents ce05d6b + 06dc8f5 commit 590332a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ fun Item(
Row {
Text(
modifier = Modifier
.padding(dimensions.spacingNormal)
.padding(dimensions.spacingMedium)
.weight(1f),
text = uiModel.id
)
Text(
modifier = Modifier
.padding(dimensions.spacingNormal)
.padding(dimensions.spacingMedium)
.weight(2f),
text = uiModel.username
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import androidx.compose.ui.unit.dp

class AppDimensions {
// Custom dimensions here
val spacingNormal = 16.dp
val spacing2XSmall = 4.dp
val spacingXSmall = 8.dp
val spacingSmall = 12.dp
val spacingMedium = 16.dp
val spacingLarge = 20.dp
val spacingXLarge = 24.dp
val spacing2XLarge = 28.dp
val spacing3XLarge = 32.dp
}

internal val LocalAppDimensions = staticCompositionLocalOf { AppDimensions() }
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private fun HomeScreenContent(
textAlign = TextAlign.Center,
modifier = Modifier
.fillMaxWidth()
.padding(all = dimensions.spacingNormal)
.padding(all = dimensions.spacingMedium)
)
}
Timber.d("Result : $uiModels")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import androidx.compose.ui.unit.dp

class AppDimensions {
// Custom dimensions here
val spacingNormal = 16.dp
val spacing2XSmall = 4.dp
val spacingXSmall = 8.dp
val spacingSmall = 12.dp
val spacingMedium = 16.dp
val spacingLarge = 20.dp
val spacingXLarge = 24.dp
val spacing2XLarge = 28.dp
val spacing3XLarge = 32.dp
}

internal val LocalAppDimensions = staticCompositionLocalOf { AppDimensions() }

0 comments on commit 590332a

Please sign in to comment.