Skip to content

Commit

Permalink
Merge pull request #25 from ltttttttttttt/dev
Browse files Browse the repository at this point in the history
Add NoInlineLayout
  • Loading branch information
ltttttttttttt authored Nov 28, 2022
2 parents a1e466d + 2564db5 commit bbc934c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ version
```kotlin
dependencies {
...
implementation("com.github.ltttttttttttt:ComposeViews:$version")//this, such as 1.3.2
implementation("com.github.ltttttttttttt:ComposeViews:$version")//this, such as 1.3.3
}
```

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ version = [![](https://jitpack.io/v/ltttttttttttt/ComposeViews.svg)](https://jit
```kotlin
dependencies {
...
implementation("com.github.ltttttttttttt:ComposeViews:$version")//this,比如1.3.2
implementation("com.github.ltttttttttttt:ComposeViews:$version")//this,比如1.3.3
}
```

Expand Down
52 changes: 26 additions & 26 deletions compose_views/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ version = "1.0.0"

kotlin {
android {
publishLibraryVariants("release")
// publishLibraryVariants("release")
}
jvm("desktop") {
compilations.all {
Expand All @@ -39,9 +39,9 @@ kotlin {
val commonMain by getting {
dependencies {
//跨平台compose
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
api(compose.runtime)
api(compose.foundation)
api(compose.material)
}
}
val commonTest by getting {
Expand All @@ -64,7 +64,7 @@ kotlin {
val desktopMain by getting {
dependencies {
//compose
implementation(compose.preview)
api(compose.preview)
//desktop图片加载器
api("com.github.ltttttttttttt:load-the-image:1.0.5")
//协程
Expand All @@ -88,26 +88,26 @@ android {
sourceSets["main"].res.srcDir("src/desktopMain/resources")
}

//publishing {
// publications {
// create("maven_public", MavenPublication::class) {
// groupId = "com.github.ltttttttttttt"
// artifactId = "library"
// version = "1.0.0"
// from(components.getByName("java"))
// }
// }
//}

afterEvaluate {
publishing {
publications {
create("maven_public", MavenPublication::class) {
groupId = "com.github.ltttttttttttt"
artifactId = "library"
version = "1.0.0"
from(components.getByName("release"))
}
publishing {
publications {
create("maven_public", MavenPublication::class) {
groupId = "com.github.ltttttttttttt"
artifactId = "library"
version = "1.0.0"
from(components.getByName("kotlin"))
}
}
}
}

//afterEvaluate {
// publishing {
// publications {
// create("maven_public", MavenPublication::class) {
// groupId = "com.github.ltttttttttttt"
// artifactId = "library"
// version = "1.0.0"
// from(components.getByName("release"))
// }
// }
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.lt.compose_views.other

import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier

/**
* creator: lt 2022/11/19 lt.dygzs@qq.com
* effect : 不内联的Layout布局,可以减少重组范围以减少不必要的重组,但会增加函数栈
* warning: 非必要情况请使用官方内联的Layout布局
*/
@Composable
fun ColumnWithNoInline(
modifier: Modifier = Modifier,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
content: @Composable ColumnScope.() -> Unit
) {
Column(modifier, verticalArrangement, horizontalAlignment, content)
}

@Composable
fun BoxWithNoInline(
modifier: Modifier = Modifier,
contentAlignment: Alignment = Alignment.TopStart,
propagateMinConstraints: Boolean = false,
content: @Composable BoxScope.() -> Unit
) {
Box(modifier, contentAlignment, propagateMinConstraints, content)
}

@Composable
fun RowWithNoInline(
modifier: Modifier = Modifier,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: Alignment.Vertical = Alignment.Top,
content: @Composable RowScope.() -> Unit
) {
Row(modifier, horizontalArrangement, verticalAlignment, content)
}

0 comments on commit bbc934c

Please sign in to comment.