-
-
Save landarskiy/36baab8bb3d4e260fde1e249c8a065c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class GridPadScopeImpl(private val cells: GridPadCells) : GridPadScope { | |
// list of composables to future measurement and placement | |
internal val data: MutableList<GridPadContent> = mutableListOf() | |
override fun item( | |
row: Int?, column: Int?, rowSpan: Int, columnSpan: Int, | |
itemContent: @Composable GridPadItemScope.() -> Unit | |
) { | |
findPlaceForContent( | |
row = row, column = column, rowSpan = rowSpan, columnSpan = columnSpan | |
) { cellRow, cellColumn -> | |
this.data.add( | |
GridPadContent( | |
row = cellRow, | |
column = cellColumn, | |
rowSpan = rowSpan, | |
columnSpan = columnSpan, | |
item = { itemContent() } | |
) | |
) | |
} | |
} | |
private fun findPlaceForContent( | |
row: Int?, column: Int?, rowSpan: Int, columnSpan: Int, | |
callback: (row: Int, column: Int) -> Unit | |
): Boolean { | |
// some logic for locating in the grid in cases where no row or column is specified | |
} | |
} | |
internal class GridPadContent( | |
val row: Int, val column: Int, val rowSpan: Int, val columnSpan: Int, | |
val item: @Composable GridPadItemScope.() -> Unit | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment