@@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
44import androidx.compose.ui.graphics.Color
55import androidx.compose.ui.unit.Dp
66
7+ @Target(AnnotationTarget .CLASS , AnnotationTarget .TYPE )
78@DslMarker
89annotation class DataTableScopeMarker
910
@@ -17,7 +18,7 @@ interface DataTableScope {
1718 * Creates a new row in the [BasicDataTable] with the specified content.
1819 */
1920 fun row (
20- content : TableRowScope .() -> Unit
21+ content : @DataTableScopeMarker TableRowScope .() -> Unit
2122 )
2223}
2324
@@ -29,7 +30,12 @@ interface TableRowScope {
2930 var isFooter: Boolean
3031 var backgroundColor: Color
3132
32- fun cell (content : @Composable () -> Unit )
33+ fun cell (content : @DataTableScopeMarker @Composable TableCellScope .() -> Unit )
34+ }
35+
36+ @DataTableScopeMarker
37+ interface TableCellScope {
38+ val columnIndex: Int
3339}
3440
3541internal class DataTableScopeImpl (
@@ -56,13 +62,17 @@ internal class TableRowScopeImpl(
5662 override var isHeader: Boolean = false
5763 override var isFooter: Boolean = false
5864 override var backgroundColor: Color = Color .Unspecified
59- val cells = mutableListOf< @Composable () -> Unit > ()
65+ val cells = mutableListOf< @Composable TableCellScope . () -> Unit > ()
6066
6167 init {
6268 apply (content)
6369 }
6470
65- override fun cell (content : @Composable () -> Unit ) {
71+ override fun cell (content : @Composable TableCellScope . () -> Unit ) {
6672 cells + = content
6773 }
6874}
75+
76+ internal class TableCellScopeImpl (
77+ override val columnIndex : Int ,
78+ ) : TableCellScope
0 commit comments