|
@@ -5,6 +5,9 @@ import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
|
+import androidx.compose.foundation.layout.FlowRow
|
|
|
+import androidx.compose.foundation.layout.Row
|
|
|
import androidx.compose.foundation.layout.Spacer
|
|
|
import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
@@ -14,6 +17,7 @@ import androidx.compose.foundation.layout.padding
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
import androidx.compose.foundation.layout.width
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
+import androidx.compose.foundation.lazy.LazyRow
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
import androidx.compose.material3.Button
|
|
|
import androidx.compose.material3.ButtonDefaults
|
|
@@ -44,12 +48,21 @@ import io.github.jan.supabase.postgrest.from
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.withContext
|
|
|
import androidx.compose.foundation.lazy.items
|
|
|
+import androidx.compose.foundation.selection.selectable
|
|
|
+import androidx.compose.material3.RadioButton
|
|
|
+import androidx.compose.foundation.layout.*
|
|
|
+import androidx.compose.material.*
|
|
|
+import androidx.compose.runtime.*
|
|
|
+
|
|
|
+@OptIn(ExperimentalLayoutApi::class)
|
|
|
@Composable
|
|
|
public fun Filters(isVisible: Boolean, onClose: () -> Unit) {
|
|
|
- var styledub by remember { mutableStateOf<List<Style_dublicate>>(listOf()) }
|
|
|
+ var styledubs by remember { mutableStateOf<List<Style_dublicate>>(listOf()) }
|
|
|
var subdubtype by remember { mutableStateOf<List<Type_subtype_dublicate>>(listOf()) }
|
|
|
var dubtype by remember { mutableStateOf<List<Type_dublicate>>(listOf()) }
|
|
|
var seasondubs by remember { mutableStateOf<List<Season_dublicate>>(listOf()) }
|
|
|
+ var selectedSeasondub by remember { mutableStateOf<Season_dublicate?>(null) }
|
|
|
+ var selectedStyledub by remember { mutableStateOf<Style_dublicate?>(null) }
|
|
|
LaunchedEffect(Unit) {
|
|
|
withContext(Dispatchers.IO) {
|
|
|
subdubtype = Constants.supabase.from("Type_subtype_dublicate")
|
|
@@ -58,7 +71,7 @@ public fun Filters(isVisible: Boolean, onClose: () -> Unit) {
|
|
|
.select().decodeList<Type_dublicate>()
|
|
|
seasondubs = Constants.supabase.from("Season_dublicate")
|
|
|
.select().decodeList<Season_dublicate>()
|
|
|
- styledub = Constants.supabase.from("Style_dublicate")
|
|
|
+ styledubs = Constants.supabase.from("Style_dublicate")
|
|
|
.select().decodeList<Style_dublicate>()
|
|
|
seasondubs.forEach { it ->
|
|
|
Log.d("ts", it.title_season)
|
|
@@ -104,11 +117,10 @@ public fun Filters(isVisible: Boolean, onClose: () -> Unit) {
|
|
|
color = Color.White,
|
|
|
shape = RoundedCornerShape(16.dp) // Закругленные края
|
|
|
)
|
|
|
- .padding(16.dp), // Отступы внутри бокса
|
|
|
-
|
|
|
+ .padding(16.dp) // Отступы внутри бокса
|
|
|
) {
|
|
|
// Используем Column для размещения текста и кнопки
|
|
|
- Column( horizontalAlignment = Alignment.CenterHorizontally) {
|
|
|
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
|
|
// Текст заголовка
|
|
|
Text(
|
|
|
text = "Фильтры",
|
|
@@ -122,55 +134,114 @@ public fun Filters(isVisible: Boolean, onClose: () -> Unit) {
|
|
|
thickness = 1.dp
|
|
|
)
|
|
|
Spacer(modifier = Modifier.height(10.dp)) // Отступ между текстом и кнопкой
|
|
|
+
|
|
|
+ // Текст "Сезон"
|
|
|
Box(
|
|
|
- modifier = Modifier.align(Alignment.Start) // Выравнивание по левому краю
|
|
|
+
|
|
|
+ modifier = Modifier.align(Alignment.Start)
|
|
|
+ .fillMaxWidth()
|
|
|
) {
|
|
|
Text("Сезон")
|
|
|
+
|
|
|
+
|
|
|
+ FlowRow(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .padding(10.dp)
|
|
|
+ ) {
|
|
|
+ seasondubs.forEach { seasondub ->
|
|
|
+ Row(
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(4.dp) // Отступы между элементами
|
|
|
+ .selectable(
|
|
|
+ selected = (seasondub == selectedSeasondub),
|
|
|
+ onClick = { selectedSeasondub = seasondub }
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ RadioButton(
|
|
|
+ selected = (seasondub == selectedSeasondub),
|
|
|
+ onClick = { selectedSeasondub = seasondub }
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = seasondub.title_season,
|
|
|
+ fontSize = 16.sp,
|
|
|
+ modifier = Modifier.padding(start = 8.dp),
|
|
|
+ color = Color(0xFF92A2B0)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Spacer(modifier = Modifier.height(10.dp))
|
|
|
- LazyColumn(
|
|
|
+ Box(
|
|
|
|
|
|
+ modifier = Modifier.align(Alignment.Start)
|
|
|
+ .fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Text("Стиль")
|
|
|
+ FlowRow(
|
|
|
modifier = Modifier
|
|
|
- .fillMaxSize(1f)
|
|
|
+ .fillMaxWidth()
|
|
|
.padding(10.dp)
|
|
|
) {
|
|
|
- items(
|
|
|
- seasondubs,
|
|
|
- key = { seasondub -> seasondub.id }
|
|
|
- ) { seasondub ->
|
|
|
+ styledubs.forEach{styledub ->
|
|
|
|
|
|
+ Row(
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(8.dp) // Отступы между элементами
|
|
|
+ .selectable(
|
|
|
+ selected = (styledub == selectedStyledub),
|
|
|
+ onClick = { selectedStyledub = styledub }
|
|
|
+ )
|
|
|
+
|
|
|
+ ) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+// .size(24.dp) // Размер для выравнивания
|
|
|
+ .width(50.dp)
|
|
|
+ .align(Alignment.CenterVertically) // Центрируем Box
|
|
|
+ ) {
|
|
|
+ RadioButton(
|
|
|
+ selected = (styledub == selectedStyledub),
|
|
|
+ onClick = { selectedStyledub = styledub }
|
|
|
+ )
|
|
|
+ }
|
|
|
Text(
|
|
|
- "Название: ${seasondub.title_season}",
|
|
|
- fontSize = 18.sp,
|
|
|
- modifier = Modifier.padding(start = 8.dp),
|
|
|
+ text = styledub.title_style,
|
|
|
+ fontSize = 16.sp,
|
|
|
+ modifier = Modifier.padding(start = 0.dp),
|
|
|
color = Color(0xFF92A2B0)
|
|
|
)
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- // Кнопка "Применить"
|
|
|
+ }
|
|
|
+
|
|
|
Button(
|
|
|
- onClick = { /* Действие при нажатии */ },
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxWidth() // Занять всю ширину
|
|
|
- .height(50.dp)
|
|
|
- .padding(horizontal = 20.dp)
|
|
|
- .background(
|
|
|
- brush = Brush.horizontalGradient(
|
|
|
- colors = listOf(
|
|
|
- Color(0xFF6F4A48),
|
|
|
- Color(0xFFE7D2A9),
|
|
|
- )
|
|
|
- ),
|
|
|
- shape = ButtonDefaults.shape
|
|
|
+ onClick = { /* Действие при нажатии */ },
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth() // Занять всю ширину
|
|
|
+ .height(50.dp)
|
|
|
+ .padding(horizontal = 20.dp)
|
|
|
+ .background(
|
|
|
+ brush = Brush.horizontalGradient(
|
|
|
+ colors = listOf(
|
|
|
+ Color(0xFF6F4A48),
|
|
|
+ Color(0xFFE7D2A9),
|
|
|
+ )
|
|
|
),
|
|
|
- colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent)
|
|
|
+ shape = ButtonDefaults.shape
|
|
|
+ ),
|
|
|
+ colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent)
|
|
|
) {
|
|
|
- Text(
|
|
|
- text = "Применить",
|
|
|
- fontSize = 16.sp,
|
|
|
- fontWeight = FontWeight.Medium
|
|
|
- )
|
|
|
- }
|
|
|
+ Text(
|
|
|
+ text = "Применить",
|
|
|
+ fontSize = 16.sp,
|
|
|
+ fontWeight = FontWeight.Medium
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|