Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default spacing definition in app dimensions #543

Closed
hoangnguyen92dn opened this issue Oct 16, 2023 · 2 comments · Fixed by #544
Closed

Add default spacing definition in app dimensions #543

hoangnguyen92dn opened this issue Oct 16, 2023 · 2 comments · Fixed by #544

Comments

@hoangnguyen92dn
Copy link
Contributor

hoangnguyen92dn commented Oct 16, 2023

Why

There is no team-wide agreement on defining consistent spacing for usage, resulting in muddled spacing dimensions for reference and making it difficult to determine the value when it is used.

For example:

    val spacingTiny = 4.dp
    val spacingSmaller = 8.dp
    val spacingSmall = 10.dp
    val spacingMedium = 12.dp
    val spacingNormal = 16.dp
    val spacingLarge = 24.dp
    val spacingHuge = 32.dp

We're adopting a new approach. The medium space is defined as 16.dp, with a spacing step of 4.dp. This simplifies both memorization and reference.

    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

🙋 Why 4.dp? Following instruction from Material Design document for spacing, padding between UI elements:

image

image


🙋 What steps should I take to define a new spacing, such as 10.dp?

To define a new spacing, it's essential to consider where it will be applied within the UI. In this context, defining new spacing would indeed be more meaningful:

    val loginButtonPadding = 10.dp

Who Benefits?

Developers

@luongvo
Copy link
Member

luongvo commented Oct 16, 2023

💯 across the board

@luongvo
Copy link
Member

luongvo commented Oct 20, 2023

@hoangnguyen92dn please update your ticket status. Currently, it's in Icebox.

ryan-conway added a commit that referenced this issue Oct 20, 2023
…-dimensions

[#543] Add default spacing definition in app dimensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants