GithubHelp home page GithubHelp logo

cheonjaeung / gridlayout-compose Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 2.0 1015 KB

Missing non lazy grid layout for Compose Multiplatform.

Home Page: https://cheonjaeung.github.io/gridlayout-compose

License: Apache License 2.0

Kotlin 100.00%
android compose-android compose-desktop compose-ios compose-multiplatform grid grid-layout jetpack-compose kotlin

gridlayout-compose's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gridlayout-compose's Issues

같은 row의 아이템 높이가 다른 경우

안녕하세요, 라이브러리를 잘 사용하고 있습니다.
다름이 아니라, 같은 줄에서 아이템 높이가 다른 경우 더 작은 아이템의 높이를 더 큰 아이템의 높이에 맞추는 기능은 혹시 구현되지 않은 건지, 아니면 제가 못 찾고 있는 건지 궁금해 이슈에 남겨놓습니다.

image

위와 같은 경우, 3Dㅇㅇㅇㅇㅇ를 제외한 나머지 아이템은 이 아이템보다 높이가 모자란 것을 볼 수 있습니다.
감사합니다!

VerticalGrid(
    columns = SimpleGridCells.Adaptive(80.dp),
    horizontalArrangement = Arrangement.spacedBy(16.dp),
    verticalArrangement = Arrangement.spacedBy(16.dp),
    modifier = Modifier
        .fillMaxWidth()
        .padding(start = 16.dp, end = 16.dp, top = 16.dp)
) {
    RoomRow("3D Printer")
    RoomRow("3D ㅇㅇㅇㅇㅇㅇㅇㅇㅇ")
    RoomRow("3D2")
    RoomRow("3D Printer")
    RoomRow("3D ㅇㅇㅇㅇㅇㅇㅇㅇㅇ")
    RoomRow("3D2")
}

i dont know why, but its laggy, when i putted this gridlayout, and list of views for room, it was so laggy....

`
data class CategoryDto(
val icon: Int,
val title: String
)

@composable
fun Categories() {
val categories = listOf(
CategoryDto(
icon = R.drawable.img_ai,
title = "Ai assistant"
),
CategoryDto(
icon = R.drawable.img_gmail,
title = "Gmail"
),
CategoryDto(
icon = R.drawable.img_mysdu,
title = "MySDU"
),
CategoryDto(
icon = R.drawable.img_sdukz,
title = "Sdu.kz"
),
CategoryDto(
icon = R.drawable.img_mysdu,
title = "Student clubs"
),
CategoryDto(
icon = R.drawable.img_free_offices,
title = "Free Offices"
),
CategoryDto(
icon = R.drawable.img_moodle,
title = "Moodle"
),
CategoryDto(
icon = R.drawable.img_library,
title = "Library"
),
)

VerticalGrid(
    columns = SimpleGridCells.Fixed(4),
    modifier = Modifier.padding(8.dp)
) {
    categories.forEach { category ->
        val context = LocalContext.current
        Category(
            category.icon,
            category.title,
            onCategoryClick = { navigateToCategory(context, category.title) },
        )
    }
}

}

@composable
fun Category(
icon: Int,
title: String,
onCategoryClick: () -> Unit,
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = Modifier
.padding(horizontal = 2.dp, vertical = 8.dp)
.clickable { onCategoryClick() }
) {
Image(
painter = painterResource(icon),
contentDescription = title,
modifier = Modifier
.size(56.dp)
.shadow(elevation = 4.dp, shape = CircleShape)
.clip(CircleShape)
)
Text(
text = title,
textAlign = TextAlign.Center,
)
}
}
`
At first - i want to say thank you for easying our job with this awsome library! buuut here is my code, and i dont know why its laggy. in homescreen i just show in lazyColumn as item this gridlayout and as next item column of notes (just simple notes with room). without this grid - notes work well, i need optimizations, please help

iOS artifacts not published to Maven Central in v1.2.2?

Hi there! Thanks for this awesome library.

I faced an issue while trying to add this to a KMP project (Kotlin 1.9.23 / Compose Multiplatform 1.6.1), as it fails while trying to download iOS artifacts.

Note that I use a Linux machine, so I can't build iOS projects anyways, but leaving iOS enabled doesn't cause me any issues (and I use quite a few KMP libraries without facing this issue). Your library's build.gradle.kts shows that iOS targets are specified, so maybe this is a publishing issue?

Vertical Grid spacedBy

The library is a great addition that's just what I needed but unfortunately there's a bug with spacing. This example will show that horizontalArrangement spacedBy does not add any spacing at all. This issue does not happen with the official LazyVerticalGrid.

VerticalGrid(
        columns = SimpleGridCells.Fixed(2),
        verticalArrangement = Arrangement.spacedBy(8.dp),
        horizontalArrangement = Arrangement.spacedBy(8.dp)
    ) {
        repeat(4) {
            Surface(
                modifier = Modifier
                    .height(100.dp)
                    .fillMaxWidth()
            ) {

            }
        }
    }

I got the issue about spaceby

when I use Spaceby VerticalGrid and set Arrangement.spacedBy("Any.dp") the last item is not add the spacing.
I got the issue at (version > 1.0.0)

Screenshot 2024-01-14 at 3 02 53 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.