untitled

Pasted Nov 11, 2026, 7:36 PM1 file190 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/zzgs7ckqyeed0s1e
untitled
package com.negocio.desinfectantes.ui.productos

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Inventory2
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material3.*
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.unit.dp
import com.negocio.desinfectantes.data.PresentacionEntity
import coil3.compose.AsyncImage
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.draw.clip
import androidx.compose.foundation.shape.RoundedCornerShape

private val NavyPresentaciones = Color(0xFF101D35)
private val CardBluePresentaciones = Color(0xFF1B2D4A)
private val AccentBluePresentaciones = Color(0xFF2585F5)
private val SoftBluePresentaciones = Color(0xFFA9BEDB)

@Composable
fun PresentacionesScreen(
    nombreProducto: String,
    nombreAroma: String,
    presentaciones: List<PresentacionEntity>,
    onVolver: () -> Unit,
    onAgregarPresentacion: () -> Unit,
    onSeleccionarPresentacion: (PresentacionEntity) -> Unit
) {
    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(20.dp)
    ) {
        Row(verticalAlignment = Alignment.CenterVertically) {
            IconButton(onClick = onVolver) {
                Icon(
                    Icons.Default.ArrowBack,
                    contentDescription = "Volver",
                    tint = SoftBluePresentaciones
                )
            }

            Column {
                Text(
                    text = nombreProducto,
                    color = Color.White,
                    style = MaterialTheme.typography.titleLarge
                )
                Text(
                    text = nombreAroma,
                    color = SoftBluePresentaciones,
                    style = MaterialTheme.typography.bodyMedium
                )
            }
        }

        Spacer(Modifier.height(24.dp))

        Text(
            "PRESENTACIONES DISPONIBLES",
            color = SoftBluePresentaciones,
            style = MaterialTheme.typography.labelMedium
        )

        Spacer(Modifier.height(16.dp))

        Button(
            onClick = onAgregarPresentacion,
            modifier = Modifier
                .fillMaxWidth()
                .height(54.dp),
            shape = RoundedCornerShape(14.dp),
            colors = ButtonDefaults.buttonColors(
                containerColor = AccentBluePresentaciones
            )
        ) {
            Icon(Icons.Default.Add, contentDescription = null)
            Spacer(Modifier.width(8.dp))
            Text("Agregar presentación")
        }

        Spacer(Modifier.height(20.dp))

        if (presentaciones.isEmpty()) {
            Card(
                modifier = Modifier.fillMaxWidth(),
                shape = RoundedCornerShape(16.dp),
                colors = CardDefaults.cardColors(
                    containerColor = CardBluePresentaciones
                )
            ) {
                Column(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(24.dp),
                    horizontalAlignment = Alignment.CenterHorizontally
                ) {
                    Icon(
                        Icons.Default.Inventory2,
                        contentDescription = null,
                        tint = AccentBluePresentaciones,
                        modifier = Modifier.size(38.dp)
                    )

                    Spacer(Modifier.height(12.dp))

                    Text(
                        "Todavía no hay presentaciones",
                        color = Color.White,
                        style = MaterialTheme.typography.titleMedium
                    )

                    Text(
                        "Agrega la primera presentación de este aroma.",
                        color = SoftBluePresentaciones
                    )
                }
            }
        } else {
            LazyColumn(
                verticalArrangement = Arrangement.spacedBy(12.dp)
            ) {
                items(presentaciones) { presentacion ->
                    Card(
                        onClick = {
                            onSeleccionarPresentacion(presentacion)
                        },
                        modifier = Modifier.fillMaxWidth(),
                        shape = RoundedCornerShape(16.dp),
                        colors = CardDefaults.cardColors(
                            containerColor = CardBluePresentaciones
                        )
                    ) {
                        Row(
                            modifier = Modifier.padding(18.dp),
                            verticalAlignment = Alignment.CenterVertically
                        ) {
                            Icon(
                                Icons.Default.Inventory2,
                                contentDescription = null,
                                tint = AccentBluePresentaciones,
                                modifier = Modifier.size(30.dp)
                            )

                            Spacer(Modifier.width(14.dp))

                            Column(modifier = Modifier.weight(1f)) {
                                Text(
                                    presentacion.nombre,
                                    color = Color.White,
                                    style = MaterialTheme.typography.titleMedium
                                )

                                Text(
                                    "${presentacion.contenidoMl} ml",
                                    color = SoftBluePresentaciones
                                )

                                Text(
                                    "$ ${presentacion.precio}",
                                    color = Color(0xFF65D6A0),
                                    style = MaterialTheme.typography.titleSmall
                                )
                            }

                            Icon(
                                Icons.Default.ChevronRight,
                                contentDescription = null,
                                tint = SoftBluePresentaciones
                            )
                        }
                    }
                }
            }
        }
    }
}



6,773 chars · codepastes.com