diff --git a/BeeTablesCompose/build.gradle.kts b/BeeTablesCompose/build.gradle.kts index a3edf70..387dfdd 100644 --- a/BeeTablesCompose/build.gradle.kts +++ b/BeeTablesCompose/build.gradle.kts @@ -17,6 +17,7 @@ plugins { id("com.android.library") id("org.jetbrains.kotlin.android") id("maven-publish") + id("org.jetbrains.kotlin.plugin.compose") } android { @@ -46,13 +47,6 @@ android { kotlinOptions { jvmTarget = "1.8" } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.14" - } - packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt index 2aece75..c2793bd 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/BeeTablesCompose.kt @@ -33,6 +33,8 @@ import com.breens.beetablescompose.components.TableHeaderComponentWithoutColumnD import com.breens.beetablescompose.components.TableRowComponent import com.breens.beetablescompose.components.TableRowComponentWithoutDividers import com.breens.beetablescompose.utils.extractMembers +import com.breens.beetablescompose.utils.lightColor +import com.breens.beetablescompose.utils.lightGray /** * 🐝 A Compose UI data table library. @@ -61,25 +63,29 @@ inline fun BeeTablesCompose( data: List, enableTableHeaderTitles: Boolean = true, headerTableTitles: List, - headerTitlesBorderColor: Color = Color.LightGray, + headerTitlesBorderColor: Color = lightGray(), headerTitlesTextStyle: TextStyle = MaterialTheme.typography.bodySmall, - headerTitlesBackGroundColor: Color = Color.White, - tableRowColors: List = listOf(Color.White, Color.White), - rowBorderColor: Color = Color.LightGray, + headerTitlesBackGroundColor: Color = lightColor(), + tableRowColors: List = listOf( + lightColor(), + lightColor(), + ), + rowBorderColor: Color = lightGray(), rowTextStyle: TextStyle = MaterialTheme.typography.bodySmall, tableElevation: Dp = 0.dp, shape: RoundedCornerShape = RoundedCornerShape(4.dp), borderStroke: BorderStroke = BorderStroke( width = 1.dp, - color = Color.LightGray, + color = lightGray(), ), disableVerticalDividers: Boolean = false, dividerThickness: Dp = 1.dp, - horizontalDividerColor: Color = Color.LightGray, + horizontalDividerColor: Color = lightGray(), contentAlignment: Alignment = Alignment.Center, textAlign: TextAlign = TextAlign.Center, tablePadding: Dp = 0.dp, columnToIndexIncreaseWidth: Int? = null, + crossinline onRowClick: (Int) -> Unit = {}, ) { OutlinedCard( elevation = CardDefaults.cardElevation(defaultElevation = tableElevation), @@ -137,6 +143,7 @@ inline fun BeeTablesCompose( textAlign = textAlign, tablePadding = tablePadding, columnToIndexIncreaseWidth = columnToIndexIncreaseWidth, + onRowClick = { onRowClick(it) }, ) } else { TableRowComponent( @@ -149,6 +156,8 @@ inline fun BeeTablesCompose( textAlign = textAlign, tablePadding = tablePadding, columnToIndexIncreaseWidth = columnToIndexIncreaseWidth, + onRowClick = { onRowClick(it) }, + ) } } diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponent.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponent.kt index 2b9a080..23dc5f9 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponent.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponent.kt @@ -35,6 +35,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.breens.beetablescompose.utils.darkColor +import com.breens.beetablescompose.utils.lightGray @Composable fun TableHeaderComponent( @@ -85,9 +87,9 @@ fun TableHeaderComponentPreview() { val titles = listOf("Team", "Home", "Away", "Points") TableHeaderComponent( headerTableTitles = titles, - headerTitlesBorderColor = Color.Black, + headerTitlesBorderColor = darkColor(), headerTitlesTextStyle = MaterialTheme.typography.labelMedium, - headerTitlesBackGroundColor = Color.LightGray, + headerTitlesBackGroundColor = lightGray(), contentAlignment = Alignment.Center, textAlign = TextAlign.Center, tablePadding = 0.dp, diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponentWithoutColumnDividers.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponentWithoutColumnDividers.kt index 4eef107..811b527 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponentWithoutColumnDividers.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableHeaderComponentWithoutColumnDividers.kt @@ -36,6 +36,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.breens.beetablescompose.utils.lightColor @Composable fun TableHeaderComponentWithoutColumnDividers( @@ -91,7 +92,7 @@ fun TableHeaderComponentWithoutColumnDividersPreview() { TableHeaderComponentWithoutColumnDividers( headerTableTitles = titles, headerTitlesTextStyle = MaterialTheme.typography.bodySmall, - headerTitlesBackGroundColor = Color.White, + headerTitlesBackGroundColor = lightColor(), dividerThickness = 1.dp, contentAlignment = Alignment.Center, textAlign = TextAlign.Center, diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt index f1212b2..56a6688 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponent.kt @@ -15,8 +15,10 @@ */ package com.breens.beetablescompose.components +import android.widget.Toast import androidx.compose.foundation.background import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -29,12 +31,15 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.breens.beetablescompose.utils.lightColor +import com.breens.beetablescompose.utils.lightGray @Composable fun TableRowComponent( @@ -47,6 +52,7 @@ fun TableRowComponent( tablePadding: Dp, columnToIndexIncreaseWidth: Int?, dividerThickness: Dp, + onRowClick: (Int) -> Unit = {}, ) { Row( Modifier @@ -62,7 +68,8 @@ fun TableRowComponent( .border( width = dividerThickness, color = rowBorderColor, - ), + ) + .clickable { onRowClick(index) }, contentAlignment = contentAlignment, ) { Text( @@ -83,13 +90,15 @@ fun TableRowComponent( @Composable @Preview(showBackground = true) fun TableRowComponentPreview() { + val context = LocalContext.current val titles = listOf("Man Utd", "26", "7", "95") TableRowComponent( data = titles, - rowBorderColor = Color.LightGray, + rowBorderColor = lightGray(), + onRowClick = { Toast.makeText(context, "Row ...${titles[it]},", Toast.LENGTH_SHORT).show() }, rowTextStyle = MaterialTheme.typography.bodySmall, - rowBackGroundColor = Color.White, + rowBackGroundColor = lightColor(), contentAlignment = Alignment.Center, textAlign = TextAlign.Center, tablePadding = 0.dp, diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt index 5ee9766..5efdf43 100644 --- a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/components/TableRowComponentWithoutVerticalDividers.kt @@ -16,6 +16,7 @@ package com.breens.beetablescompose.components import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -36,6 +37,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.breens.beetablescompose.utils.lightGray @Composable fun TableRowComponentWithoutDividers( @@ -48,6 +50,7 @@ fun TableRowComponentWithoutDividers( textAlign: TextAlign, tablePadding: Dp, columnToIndexIncreaseWidth: Int?, + onRowClick: (Int) -> Unit = {}, ) { Column( modifier = Modifier.padding(horizontal = tablePadding), @@ -61,8 +64,10 @@ fun TableRowComponentWithoutDividers( val weight = if (index == columnToIndexIncreaseWidth) 8f else 2f Box( modifier = Modifier - .weight(weight), + .weight(weight) + .clickable { onRowClick(index) }, contentAlignment = contentAlignment, + ) { Text( text = title, @@ -94,9 +99,9 @@ fun TableRowComponentWithoutDividersPreview() { TableRowComponentWithoutDividers( data = titles, rowTextStyle = MaterialTheme.typography.bodySmall, - rowBackGroundColor = Color.White, + rowBackGroundColor = MaterialTheme.colorScheme.background, dividerThickness = 1.dp, - horizontalDividerColor = Color.LightGray, + horizontalDividerColor = lightGray(), contentAlignment = Alignment.Center, textAlign = TextAlign.Center, tablePadding = 0.dp, diff --git a/BeeTablesCompose/src/main/java/com/breens/beetablescompose/utils/ColorUtils.kt b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/utils/ColorUtils.kt new file mode 100644 index 0000000..9017dba --- /dev/null +++ b/BeeTablesCompose/src/main/java/com/breens/beetablescompose/utils/ColorUtils.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2023 Breens Mbaka + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.breens.beetablescompose.utils + +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable + +@Composable +fun lightGray() = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.12f) + +@Composable +fun darkColor() = MaterialTheme.colorScheme.onBackground + +@Composable +fun lightColor() = MaterialTheme.colorScheme.background diff --git a/README.md b/README.md index d5f8c6f..f4a8bac 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,12 @@ repositories { ```gradle dependencies { - implementation("com.github.Breens-Mbaka:BeeTablesCompose:1.0.5") + implementation("com.github.Breens-Mbaka:BeeTablesCompose:1.2.0") } ``` +# Usage + - Import the library: Import the BeeTablesCompose function into your Compose-based project. - Prepare your data: Organize your data in a list of objects to be displayed in the table. @@ -66,6 +68,17 @@ dependencies {

+# NOTE ⚠ī¸đŸš¨ +- Before building a release APK of your app, if you have enabled minification, make sure to annotate your table data classes with @Keep. This will prevent the class from being removed at runtime. +```kotlin +@Keep +data class User( + val name: String, + val email: Int, + val city: String +) +``` + # Want a new shiny feature đŸĒŠâœ¨ - If you want to request a new feature please first read this [short guide](https://github.com/Breens-Mbaka/BeeTablesCompose/blob/master/.github/ISSUE_TEMPLATE/feature_request.md) @@ -85,7 +98,7 @@ Also __[follow](https://github.com/Breens-Mbaka)__ me for my next creations! # License ```xml -Designed and developed by 2023 Breens Mbaka +Designed and developed by 2024 Breens Mbaka Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 679ce42..e4255b9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,6 +16,7 @@ plugins { id("com.android.application") id("org.jetbrains.kotlin.android") + id("org.jetbrains.kotlin.plugin.compose") } android { @@ -51,12 +52,6 @@ android { kotlinOptions { jvmTarget = "1.8" } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.14" - } packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" diff --git a/app/src/main/java/com/breens/beetablescompose/MainActivity.kt b/app/src/main/java/com/breens/beetablescompose/MainActivity.kt index 3afd623..5a72579 100644 --- a/app/src/main/java/com/breens/beetablescompose/MainActivity.kt +++ b/app/src/main/java/com/breens/beetablescompose/MainActivity.kt @@ -16,6 +16,7 @@ package com.breens.beetablescompose import android.os.Bundle +import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.Arrangement @@ -29,6 +30,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material3.Checkbox import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Slider +import androidx.compose.material3.Surface import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.runtime.getValue @@ -38,8 +40,10 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import com.breens.beetablescompose.ui.theme.BeeTablesComposeTheme import com.breens.beetablescompose.utils.premierLeagueTeams import com.breens.beetablescompose.utils.titles @@ -47,212 +51,223 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - var disableVerticalDividers by remember { - mutableStateOf(false) - } - var horizontalDividerThickness by remember { - mutableStateOf(0.6f) - } + val context = LocalContext.current + BeeTablesComposeTheme { + Surface( + color = MaterialTheme.colorScheme.background, + ) { + var disableVerticalDividers by remember { + mutableStateOf(false) + } + var horizontalDividerThickness by remember { + mutableStateOf(0.6f) + } - var enableHeaderTitles by remember { - mutableStateOf(false) - } + var enableHeaderTitles by remember { + mutableStateOf(false) + } - var centerContent by remember { - mutableStateOf(false) - } + var centerContent by remember { + mutableStateOf(false) + } - var centerTextAlignment by remember { - mutableStateOf(false) - } + var centerTextAlignment by remember { + mutableStateOf(false) + } - var increaseColumnWidth by remember { - mutableStateOf(null) - } + var increaseColumnWidth by remember { + mutableStateOf(null) + } - LazyColumn(contentPadding = PaddingValues(16.dp)) { - item { - BeeTablesCompose( - data = premierLeagueTeams, - enableTableHeaderTitles = enableHeaderTitles, - disableVerticalDividers = disableVerticalDividers, - dividerThickness = horizontalDividerThickness.dp, - columnToIndexIncreaseWidth = increaseColumnWidth?.minus(1), - headerTableTitles = titles, - headerTitlesBackGroundColor = Color(0XFFE9AB17), - tableRowColors = listOf( - MaterialTheme.colorScheme.surface, - MaterialTheme.colorScheme.surface, - ), - contentAlignment = if (centerContent) Alignment.Center else Alignment.CenterStart, - textAlign = if (centerTextAlignment) TextAlign.Center else TextAlign.Start, - ) + LazyColumn(contentPadding = PaddingValues(16.dp)) { + item { + BeeTablesCompose( + data = premierLeagueTeams, + enableTableHeaderTitles = enableHeaderTitles, + disableVerticalDividers = disableVerticalDividers, + dividerThickness = horizontalDividerThickness.dp, + columnToIndexIncreaseWidth = increaseColumnWidth?.minus(1), + headerTableTitles = titles, + headerTitlesBackGroundColor = Color(0XFFE9AB17), + tableRowColors = listOf( + MaterialTheme.colorScheme.surface, + MaterialTheme.colorScheme.surface, + ), + contentAlignment = if (centerContent) Alignment.Center else Alignment.CenterStart, + textAlign = if (centerTextAlignment) TextAlign.Center else TextAlign.Start, - Spacer(modifier = Modifier.padding(12.dp)) - } + onRowClick = { index -> + Log.i("TAG", "AM click at position ${ premierLeagueTeams[index]}") + }, + ) - item { - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, - ) { - Text( - text = "Enable Table Header Titles", - style = MaterialTheme.typography.bodyMedium, - ) - Switch( - checked = enableHeaderTitles, - onCheckedChange = { - enableHeaderTitles = it - }, - ) - } + Spacer(modifier = Modifier.padding(12.dp)) + } - Spacer(modifier = Modifier.padding(12.dp)) - } - item { - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, - ) { - Text( - text = "Hide Vertical Divider", - style = MaterialTheme.typography.bodyMedium, - ) - Switch( - checked = disableVerticalDividers, - onCheckedChange = { - disableVerticalDividers = it - }, - ) - } + item { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = "Enable Table Header Titles", + style = MaterialTheme.typography.bodyMedium, + ) + Switch( + checked = enableHeaderTitles, + onCheckedChange = { + enableHeaderTitles = it + }, + ) + } - Spacer(modifier = Modifier.padding(8.dp)) - } + Spacer(modifier = Modifier.padding(12.dp)) + } + item { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = "Hide Vertical Divider", + style = MaterialTheme.typography.bodyMedium, + ) + Switch( + checked = disableVerticalDividers, + onCheckedChange = { + disableVerticalDividers = it + }, + ) + } - item { - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, - ) { - Text( - text = "Divider Thickness", - style = MaterialTheme.typography.bodyMedium, - ) + Spacer(modifier = Modifier.padding(8.dp)) + } - Slider(value = horizontalDividerThickness, onValueChange = { - horizontalDividerThickness = it - }) - } - } + item { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = "Divider Thickness", + style = MaterialTheme.typography.bodyMedium, + ) - item { - Spacer(modifier = Modifier.padding(12.dp)) + Slider(value = horizontalDividerThickness, onValueChange = { + horizontalDividerThickness = it + }) + } + } - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, - ) { - Text( - text = "Center Content", - style = MaterialTheme.typography.bodyMedium, - ) - Switch( - checked = centerContent, - onCheckedChange = { - centerContent = it - }, - ) - } + item { + Spacer(modifier = Modifier.padding(12.dp)) - Spacer(modifier = Modifier.padding(12.dp)) - } + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = "Center Content", + style = MaterialTheme.typography.bodyMedium, + ) + Switch( + checked = centerContent, + onCheckedChange = { + centerContent = it + }, + ) + } - item { - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, - ) { - Text( - text = "Text Alignment Center", - style = MaterialTheme.typography.bodyMedium, - ) - Switch( - checked = centerTextAlignment, - onCheckedChange = { - centerTextAlignment = it - }, - ) - } + Spacer(modifier = Modifier.padding(12.dp)) + } - Spacer(modifier = Modifier.padding(12.dp)) - } + item { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = "Text Alignment Center", + style = MaterialTheme.typography.bodyMedium, + ) + Switch( + checked = centerTextAlignment, + onCheckedChange = { + centerTextAlignment = it + }, + ) + } - item { - Column { - Text( - text = "The Column To Increase Width", - style = MaterialTheme.typography.bodyMedium, - ) - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text(text = "1", style = MaterialTheme.typography.bodySmall) - Checkbox( - checked = increaseColumnWidth == 1, - onCheckedChange = { - increaseColumnWidth = if (it) 1 else null - }, - ) + Spacer(modifier = Modifier.padding(12.dp)) } - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text(text = "2", style = MaterialTheme.typography.bodySmall) - Checkbox( - checked = increaseColumnWidth == 2, - onCheckedChange = { - increaseColumnWidth = if (it) 2 else null - }, - ) - } + item { + Column { + Text( + text = "The Column To Increase Width", + style = MaterialTheme.typography.bodyMedium, + ) + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text(text = "1", style = MaterialTheme.typography.bodySmall) + Checkbox( + checked = increaseColumnWidth == 1, + onCheckedChange = { + increaseColumnWidth = if (it) 1 else null + }, + ) + } - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text(text = "3", style = MaterialTheme.typography.bodySmall) - Checkbox( - checked = increaseColumnWidth == 3, - onCheckedChange = { - increaseColumnWidth = if (it) 3 else null - }, - ) - } + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text(text = "2", style = MaterialTheme.typography.bodySmall) + Checkbox( + checked = increaseColumnWidth == 2, + onCheckedChange = { + increaseColumnWidth = if (it) 2 else null + }, + ) + } - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text(text = "4", style = MaterialTheme.typography.bodySmall) - Checkbox( - checked = increaseColumnWidth == 4, - onCheckedChange = { - increaseColumnWidth = if (it) 4 else null - }, - ) + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text(text = "3", style = MaterialTheme.typography.bodySmall) + Checkbox( + checked = increaseColumnWidth == 3, + onCheckedChange = { + increaseColumnWidth = if (it) 3 else null + }, + ) + } + + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text(text = "4", style = MaterialTheme.typography.bodySmall) + Checkbox( + checked = increaseColumnWidth == 4, + onCheckedChange = { + increaseColumnWidth = if (it) 4 else null + }, + ) + } + } } } } diff --git a/build.gradle.kts b/build.gradle.kts index 8e13975..c56d84e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,10 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { id("com.android.application") version "8.1.4" apply false - id("org.jetbrains.kotlin.android") version "1.9.24" apply false + id("org.jetbrains.kotlin.android") version "2.0.0" apply false id("com.android.library") version "8.1.4" apply false id("com.diffplug.spotless") version "6.19.0" apply false + id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" apply false } subprojects {