diff --git a/app/src/main/java/com/example/myapplication/database/entities/composeui/ReportPage.kt b/app/src/main/java/com/example/myapplication/database/entities/composeui/ReportPage.kt index 10b4fa2..180315b 100644 --- a/app/src/main/java/com/example/myapplication/database/entities/composeui/ReportPage.kt +++ b/app/src/main/java/com/example/myapplication/database/entities/composeui/ReportPage.kt @@ -50,7 +50,9 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle @@ -213,7 +215,7 @@ fun ReportPage (navController: NavController?, viewModel: ReportViewModel = view TableScreen(reportData = reportResultPageState.resReport) - Spacer(modifier = Modifier.height(16.dp)) + Spacer(modifier = Modifier.height(4.dp)) if (viewModel.reportPageUiState.isEntryValid) { Button( @@ -287,31 +289,43 @@ fun RowScope.TableCell( @Composable fun TableScreen(reportData: List) { - val column1Weight = .3f // 30% - val column2Weight = 1f // 30% - Column( Modifier - .padding(16.dp) + .padding(8.dp) ) { - Row(Modifier.background(Color.White)) { - TableCell(text = "ID\n", weight = column1Weight) - TableCell(text = "Дата\n", weight = column1Weight) - TableCell(text = "Вес\n", weight = column1Weight) - TableCell(text = "Кол-во", weight = column1Weight) - TableCell(text = "ID вел.", weight = column1Weight) + Row( + modifier = Modifier + .background(MaterialTheme.colorScheme.onBackground) + .height(48.dp) + .padding(4.dp) + .fillMaxWidth(), // Занимаем максимальную ширину + verticalAlignment = Alignment.CenterVertically // Выравниваем по центру вертикали + ) { + Text("ID", Modifier.weight(0.5f), color = MaterialTheme.colorScheme.background) + Text("Дата", Modifier.weight(1.0f), color = MaterialTheme.colorScheme.background) + Text("Вес", Modifier.weight(1.0f), color = MaterialTheme.colorScheme.background) + Text("Кол-во", Modifier.weight(1.0f), color = MaterialTheme.colorScheme.background) + Text("ID вел.", Modifier.weight(1.0f), color = MaterialTheme.colorScheme.background) } // Here are all the lines of your table. reportData.forEach { val (id, dateTime, weight, maxCount, bikeId) = it - Row(Modifier.fillMaxWidth()) { - TableCell(text = id.toString(), weight = column1Weight) - TableCell(text = dateTime.toString(), weight = column1Weight) - TableCell(text = weight.toString(), weight = column1Weight) - TableCell(text = maxCount.toString(), weight = column1Weight) - TableCell(text = bikeId.toString(), weight = column1Weight) + Card( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 8.dp, horizontal = 4.dp), + ) { + Row(Modifier + .fillMaxWidth() + .background(MaterialTheme.colorScheme.background)) { + Text(id.toString(), Modifier.weight(0.5f)) + Text(dateTime.toString(), Modifier.weight(1.0f)) + Text(weight.toString(), Modifier.weight(1.0f)) + Text(maxCount.toString(), Modifier.weight(1.0f)) + Text(bikeId.toString(), Modifier.weight(1.0f)) + } } } }