Skip to content

Commit

Permalink
Add "⚡ Layouts" quick section
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Jun 16, 2023
1 parent 2496554 commit 0168edf
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 109 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@

- Support for custom components

## [2023.06.16] Improvements
## [0.0.2] Initial feedback

### Added

- **Quick Action:** Added "⚡ Layouts" section that contains
`Column`, `Row`, `Box`, `LazyColumn` and `LazyRow`.

### Changed

- **Quick Action:** Moved the layouts from "⚡ Quick UI" to
"⚡ Layouts"

### Fixed

- Imports bug in the quick action
- Imports bug in the Quick Action
where imports were added above "package"
caused by `@file:OptIn()` 🐛

## [2023.05.30] Initial release
## [0.0.1] Initial release

### Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import com.ivyapps.composehammer.domain.data.material3.MaterialComponentsGroup
class MaterialComponentsService(project: Project) {
val content by lazy {
buildList {
common()
quickUi()
layouts()
composeRuntime()
animations()
buttons()
Expand Down
114 changes: 114 additions & 0 deletions src/main/kotlin/com/ivyapps/composehammer/m3content/Layouts.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package com.ivyapps.composehammer.m3content

import com.ivyapps.composehammer.domain.ContentScope
import com.ivyapps.composehammer.domain.component
import com.ivyapps.composehammer.domain.group

fun ContentScope.layouts() = group(
title = "⚡ Layouts",
showInToolWindow = false
) {
component {
showInToolWindow = false
name = "Column"
imports = listOf(
"androidx.compose.ui.Modifier",
"androidx.compose.foundation.layout.Column"
)
code = """
Column(
modifier = Modifier,
) {
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Row"
imports = listOf(
"androidx.compose.ui.Modifier",
"androidx.compose.foundation.layout.Row",
"androidx.compose.ui.Alignment",
)
code = """
Row(
modifier = Modifier,
verticalAlignment = Alignment.CenterVertically,
) {
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Box"
imports = listOf(
"androidx.compose.ui.Modifier",
"androidx.compose.foundation.layout.Box",
"androidx.compose.ui.Alignment",
)
code = """
Box(
modifier = Modifier,
contentAlignment = Alignment.Center,
) {
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Lazy Column"
imports = listOf(
"androidx.compose.foundation.layout.PaddingValues",
"androidx.compose.foundation.lazy.LazyColumn",
"androidx.compose.foundation.lazy.items",
"androidx.compose.ui.Modifier",
"androidx.compose.ui.unit.dp",
)
code = """
LazyColumn(
modifier = Modifier,
contentPadding = PaddingValues(vertical = 8.dp) // 8.dp between each item
) {
item {
// If you want a single item
}
items(items = listOf<Any>()) { item ->
// display a single list item
// it's like forEach {}
}
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Lazy Row"
imports = listOf(
"androidx.compose.foundation.layout.PaddingValues",
"androidx.compose.foundation.lazy.LazyRow",
"androidx.compose.foundation.lazy.items",
"androidx.compose.ui.Modifier",
"androidx.compose.ui.unit.dp",
)
code = """
LazyRow(
modifier = Modifier,
contentPadding = PaddingValues(horizontal = 8.dp) // 8.dp between each item
) {
item {
// If you want a single item
}
items(items = listOf<Any>()) { item ->
// display a single list item
// it's like forEach {}
}
}
""".trimIndent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.ivyapps.composehammer.domain.ContentScope
import com.ivyapps.composehammer.domain.component
import com.ivyapps.composehammer.domain.group

fun ContentScope.common() = group(
fun ContentScope.quickUi() = group(
title = "⚡ Quick UI",
showInToolWindow = false
) {
Expand Down Expand Up @@ -101,58 +101,6 @@ fun ContentScope.common() = group(
""".trimIndent()
}

component {
showInToolWindow = false
name = "Column"
imports = listOf(
"androidx.compose.ui.Modifier",
"androidx.compose.foundation.layout.Column"
)
code = """
Column(
modifier = Modifier,
) {
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Row"
imports = listOf(
"androidx.compose.ui.Modifier",
"androidx.compose.foundation.layout.Row",
"androidx.compose.ui.Alignment",
)
code = """
Row(
modifier = Modifier,
verticalAlignment = Alignment.CenterVertically,
) {
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Box"
imports = listOf(
"androidx.compose.ui.Modifier",
"androidx.compose.foundation.layout.Box",
"androidx.compose.ui.Alignment",
)
code = """
Box(
modifier = Modifier,
contentAlignment = Alignment.Center,
) {
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "MaterialTheme.typography"
Expand All @@ -175,58 +123,6 @@ fun ContentScope.common() = group(
""".trimIndent()
}

component {
showInToolWindow = false
name = "Lazy Column"
imports = listOf(
"androidx.compose.foundation.layout.PaddingValues",
"androidx.compose.foundation.lazy.LazyColumn",
"androidx.compose.foundation.lazy.items",
"androidx.compose.ui.Modifier",
"androidx.compose.ui.unit.dp",
)
code = """
LazyColumn(
modifier = Modifier,
contentPadding = PaddingValues(vertical = 8.dp) // 8.dp between each item
) {
item {
// If you want a single item
}
items(items = listOf<Any>()) { item ->
// display a single list item
// it's like forEach {}
}
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "Lazy Row"
imports = listOf(
"androidx.compose.foundation.layout.PaddingValues",
"androidx.compose.foundation.lazy.LazyRow",
"androidx.compose.foundation.lazy.items",
"androidx.compose.ui.Modifier",
"androidx.compose.ui.unit.dp",
)
code = """
LazyRow(
modifier = Modifier,
contentPadding = PaddingValues(horizontal = 8.dp) // 8.dp between each item
) {
item {
// If you want a single item
}
items(items = listOf<Any>()) { item ->
// display a single list item
// it's like forEach {}
}
}
""".trimIndent()
}

component {
showInToolWindow = false
name = "modifier = Modifier"
Expand Down

0 comments on commit 0168edf

Please sign in to comment.