Minor fixes
This commit is contained in:
parent
6628daed50
commit
715b591b8a
|
|
@ -9,6 +9,8 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Info
|
||||||
|
import androidx.compose.material.icons.outlined.Info
|
||||||
import androidx.compose.material.icons.outlined.LocationOn
|
import androidx.compose.material.icons.outlined.LocationOn
|
||||||
import androidx.compose.material.icons.outlined.Visibility
|
import androidx.compose.material.icons.outlined.Visibility
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
|
@ -153,12 +155,23 @@ fun BuyAnimalCard(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Row {
|
||||||
product.name ?: "",
|
Text(
|
||||||
fontSize = AppTypography.Body,
|
product.breed ?: "",
|
||||||
fontWeight = FontWeight.Medium
|
fontSize = AppTypography.Body,
|
||||||
)
|
fontWeight = FontWeight.Medium
|
||||||
Text(
|
)
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Info,
|
||||||
|
contentDescription = null,
|
||||||
|
Modifier.padding(horizontal = 4.dp).size(16.dp).align(Alignment.CenterVertically),
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
//InfoIconWithOverlay(infoText = product.breedInfo ?: "")
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
formatPrice(product.price),
|
formatPrice(product.price),
|
||||||
fontSize = AppTypography.Body,
|
fontSize = AppTypography.Body,
|
||||||
fontWeight = FontWeight.Medium
|
fontWeight = FontWeight.Medium
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.example.livingai_lg.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.LocalIndication
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.outlined.Info
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.TooltipBox
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.icons.filled.Info
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TooltipDefaults
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.zIndex
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun InfoTooltipOverlay(
|
||||||
|
text: String,
|
||||||
|
visible: Boolean,
|
||||||
|
onDismiss: () -> Unit
|
||||||
|
) {
|
||||||
|
if (!visible) return
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.zIndex(100f) // ensure it overlays everything
|
||||||
|
) {
|
||||||
|
// Dimmed background
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black.copy(alpha = 0.35f))
|
||||||
|
.clickable(
|
||||||
|
indication = null,
|
||||||
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
|
) {
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Tooltip card
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.Center)
|
||||||
|
.background(Color.Black, RoundedCornerShape(12.dp))
|
||||||
|
.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
lineHeight = 18.sp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun InfoIconWithOverlay(
|
||||||
|
infoText: String
|
||||||
|
) {
|
||||||
|
var showInfo by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
Box {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.Info,
|
||||||
|
contentDescription = "Info",
|
||||||
|
tint = Color.Gray,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(18.dp)
|
||||||
|
.clickable { showInfo = true }
|
||||||
|
)
|
||||||
|
|
||||||
|
InfoTooltipOverlay(
|
||||||
|
text = infoText,
|
||||||
|
visible = showInfo,
|
||||||
|
onDismiss = { showInfo = false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ data class Animal(
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
val age: Int? = null,
|
val age: Int? = null,
|
||||||
val breed: String? = null,
|
val breed: String? = null,
|
||||||
|
val breedInfo: String? = null,
|
||||||
val price: Long? = null,
|
val price: Long? = null,
|
||||||
val isFairPrice: Boolean? = null,
|
val isFairPrice: Boolean? = null,
|
||||||
val imageUrl: List<String>? = null,
|
val imageUrl: List<String>? = null,
|
||||||
|
|
@ -28,6 +29,7 @@ val sampleAnimals = listOf(
|
||||||
name = "Rita",
|
name = "Rita",
|
||||||
age = 45,
|
age = 45,
|
||||||
breed = "Gir",
|
breed = "Gir",
|
||||||
|
breedInfo = "The 2nd best in India",
|
||||||
location = "Punjab",
|
location = "Punjab",
|
||||||
distance = 12000,
|
distance = 12000,
|
||||||
imageUrl = listOf("https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2F4.bp.blogspot.com%2F_tecSnxaePMo%2FTLLVknW8dOI%2FAAAAAAAAACo%2F_kd1ZNBXU1o%2Fs1600%2FGIR%2CGujrat.jpg&f=1&nofb=1&ipt=da6ba1d040c396b64d3f08cc99998f66200dcd6c001e4a56def143ab3d1a87ea","https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcpimg.tistatic.com%2F4478702%2Fb%2F4%2Fgir-cow.jpg&f=1&nofb=1&ipt=19bf391461480585c786d01433d863a383c60048ac2ce063ce91f173e215205d"),
|
imageUrl = listOf("https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2F4.bp.blogspot.com%2F_tecSnxaePMo%2FTLLVknW8dOI%2FAAAAAAAAACo%2F_kd1ZNBXU1o%2Fs1600%2FGIR%2CGujrat.jpg&f=1&nofb=1&ipt=da6ba1d040c396b64d3f08cc99998f66200dcd6c001e4a56def143ab3d1a87ea","https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcpimg.tistatic.com%2F4478702%2Fb%2F4%2Fgir-cow.jpg&f=1&nofb=1&ipt=19bf391461480585c786d01433d863a383c60048ac2ce063ce91f173e215205d"),
|
||||||
|
|
@ -49,6 +51,7 @@ val sampleAnimals = listOf(
|
||||||
price = 95000,
|
price = 95000,
|
||||||
age = 35,
|
age = 35,
|
||||||
breed = "Sahiwal",
|
breed = "Sahiwal",
|
||||||
|
breedInfo = "The 2nd best in India",
|
||||||
location = "Punjab",
|
location = "Punjab",
|
||||||
isFairPrice = true,
|
isFairPrice = true,
|
||||||
imageUrl = listOf("https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdnbbsr.s3waas.gov.in%2Fs3a5a61717dddc3501cfdf7a4e22d7dbaa%2Fuploads%2F2020%2F09%2F2020091812-1024x680.jpg&f=1&nofb=1&ipt=bb426406b3747e54151e4812472e203f33922fa3b4e11c4feef9aa59a5733146"),
|
imageUrl = listOf("https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdnbbsr.s3waas.gov.in%2Fs3a5a61717dddc3501cfdf7a4e22d7dbaa%2Fuploads%2F2020%2F09%2F2020091812-1024x680.jpg&f=1&nofb=1&ipt=bb426406b3747e54151e4812472e203f33922fa3b4e11c4feef9aa59a5733146"),
|
||||||
|
|
@ -67,6 +70,7 @@ val sampleAnimals = listOf(
|
||||||
name = "Bessie",
|
name = "Bessie",
|
||||||
age = 48,
|
age = 48,
|
||||||
breed = "Holstein Friesian",
|
breed = "Holstein Friesian",
|
||||||
|
breedInfo = "Not Indian",
|
||||||
location = "Punjab",
|
location = "Punjab",
|
||||||
distance = 12000,
|
distance = 12000,
|
||||||
imageUrl = listOf("https://api.builder.io/api/v1/image/assets/TEMP/885e24e34ede6a39f708df13dabc4c1683c3e976?width=786"),
|
imageUrl = listOf("https://api.builder.io/api/v1/image/assets/TEMP/885e24e34ede6a39f708df13dabc4c1683c3e976?width=786"),
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ object AppScreen {
|
||||||
|
|
||||||
object Graph {
|
object Graph {
|
||||||
const val AUTH = "auth"
|
const val AUTH = "auth"
|
||||||
const val MAIN = "main"
|
const val MAIN = "auth"
|
||||||
|
|
||||||
fun auth(route: String)=
|
fun auth(route: String)=
|
||||||
"$AUTH/$route"
|
"$AUTH/$route"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue