From 34f56e6c89fabb75e465dacbfa033b1308f006e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Tue, 26 Dec 2023 01:27:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=AF=20=D0=B1=D1=8B=20=D0=BD=D0=B5=20=D0=B7?= =?UTF-8?q?=D0=B0=D1=81=D0=BD=D1=83=D0=BB,=20=D0=B5=D1=81=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=B1=D1=8B=20=D0=BD=D0=B5=20=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BB=20=D0=B4=D0=B5=D0=B7=D0=B8=D0=B3=D0=BD,=20=D0=B2?= =?UTF-8?q?=D0=BE=D1=82=20=D1=81=D0=B5=D0=B9=D1=87=D0=B0=D1=81=20=D0=B5?= =?UTF-8?q?=D1=89=D0=B5=20=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D1=8E=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D1=87=D0=BA=D0=B8=20=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B2=D1=82=D1=80=D0=B0=20=D0=BD=D0=B0=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=83=20=D0=BA=209....?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/entities/composeui/ReportPage.kt | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) 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)) + } } } }