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

Always provide a Modifier Parameter #82

Closed
Spikeysanju opened this issue Oct 23, 2021 · 1 comment · Fixed by #85
Closed

Always provide a Modifier Parameter #82

Spikeysanju opened this issue Oct 23, 2021 · 1 comment · Fixed by #85
Assignees
Labels
nice to have New feature or request

Comments

@Spikeysanju
Copy link
Owner

Is your feature request related to a problem? Please describe.
According to latest blog from Chris Banes. It's better to always provide a Modifier to Composable.

Link to blog - https://chris.banes.dev/always-provide-a-modifier/

Describe the solution you'd like
Any composable you write which emits layout (even a simple Box), should have a modifier: Modifier parameter, which is then used in the layout.

Sample code from the blog

/**
 * This now has a modifier parameter, allowing callers
 * to customize the layout, behavior and more!
 */
@Composable
private fun HeaderText(
    text: String,
    modifier: Modifier = Modifier,
) {
    Text(
        modifier = modifier,
        // ...
    )
}

@Spikeysanju Spikeysanju added the nice to have New feature or request label Oct 23, 2021
@Spikeysanju Spikeysanju added this to the v1.0.0-alpha02 milestone Oct 23, 2021
@Spikeysanju Spikeysanju self-assigned this Oct 23, 2021
@Spikeysanju Spikeysanju moved this to In Progress in Einsen Oct 23, 2021
@Spikeysanju
Copy link
Owner Author

Started working on this issue 👍

Spikeysanju added a commit that referenced this issue Oct 25, 2021
Spikeysanju added a commit that referenced this issue Oct 25, 2021
Add `Modifier` params to `All Composables` #82 | Update `BG color` to…
Repository owner moved this from In Progress to Done in Einsen Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice to have New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant