fix: size and dime
This commit is contained in:
@@ -143,7 +143,7 @@ fun CustomTextFilled(
|
|||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.padding(horizontal = if (showClearButton && localValue.isNotEmpty()) 4.dp else 0.dp),
|
.padding(horizontal = if (showClearButton && localValue.isNotEmpty()) MaterialTheme.dime.xs else 0.dp),
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
readOnly = readOnly,
|
readOnly = readOnly,
|
||||||
singleLine = singleLine,
|
singleLine = singleLine,
|
||||||
|
|||||||
+6
-19
@@ -1,37 +1,26 @@
|
|||||||
package com.approagency.pharmacy.presentation.common
|
package com.approagency.pharmacy.presentation.common
|
||||||
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import com.vada.caller.ui.theme.dime
|
||||||
import com.vada.caller.ui.theme.LocalDime
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LoadingMoreIndicator(
|
fun LoadingMoreIndicator(
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val dime = LocalDime.current
|
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(dime.lg),
|
.padding(MaterialTheme.dime.lg),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
CircularProgressIndicator(
|
Loading()
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,18 +28,16 @@ fun LoadingMoreIndicator(
|
|||||||
fun EndOfListIndicator(
|
fun EndOfListIndicator(
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val dime = LocalDime.current
|
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(dime.xl),
|
.padding(MaterialTheme.dime.xl),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "پایان نتایج",
|
text = "پایان نتایج",
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f),
|
style = MaterialTheme.typography.bodySmall,
|
||||||
fontSize = 12.sp
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,67 @@
|
|||||||
package com.approagency.pharmacy.presentation.common
|
package com.approagency.pharmacy.presentation.common
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.vada.caller.ui.theme.dime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* تنها کامپوزبل لودینگ برنامه — همهجا از همین استفاده میشود.
|
||||||
|
*
|
||||||
|
* - بدون [message] فقط یک اسپینر برمیگرداند (برای دکمهها، ردیفها و غیره):
|
||||||
|
* Loading() // اسپینر ساده
|
||||||
|
* Loading(size = 24.dp) // اسپینر کوچکتر
|
||||||
|
* Loading(color = MaterialTheme.colorScheme.onPrimary) // روی دکمهی primary
|
||||||
|
*
|
||||||
|
* - با [message] یک حالت لودینگ وسطچین همراه متن میسازد (تمامصفحه/ناحیهای):
|
||||||
|
* Loading(modifier = Modifier.fillMaxSize(), message = "در حال جستجو...")
|
||||||
|
*
|
||||||
|
* رنگ پیشفرض primary است تا روی پسزمینهی معمول دیده شود.
|
||||||
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun Loading(
|
fun Loading(
|
||||||
color: Color = MaterialTheme.colorScheme.onPrimary,
|
modifier: Modifier = Modifier,
|
||||||
modifier: Modifier = Modifier
|
message: String? = null,
|
||||||
|
size: Dp = 40.dp,
|
||||||
|
color: Color = MaterialTheme.colorScheme.primary,
|
||||||
|
strokeWidth: Dp = 3.dp
|
||||||
) {
|
) {
|
||||||
|
if (message.isNullOrBlank()) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
|
modifier = modifier.size(size),
|
||||||
color = color,
|
color = color,
|
||||||
modifier = modifier,
|
strokeWidth = strokeWidth
|
||||||
strokeWidth = 2.dp
|
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
Box(
|
||||||
|
modifier = modifier.fillMaxWidth(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
CircularProgressIndicator(
|
||||||
|
modifier = Modifier.size(size),
|
||||||
|
color = color,
|
||||||
|
strokeWidth = strokeWidth
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(MaterialTheme.dime.md))
|
||||||
|
Text(
|
||||||
|
text = message,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -24,13 +23,17 @@ fun PrimaryButton(
|
|||||||
contentColor = MaterialTheme.colorScheme.onPrimary
|
contentColor = MaterialTheme.colorScheme.onPrimary
|
||||||
),
|
),
|
||||||
shape = MaterialTheme.shapes.medium,
|
shape = MaterialTheme.shapes.medium,
|
||||||
modifier = Modifier.fillMaxWidth().height(height?.dp ?: 50.dp),
|
enabled = isLoading != true,
|
||||||
onClick = {
|
modifier = Modifier
|
||||||
onClick()
|
.fillMaxWidth()
|
||||||
},
|
.height(height?.dp ?: 50.dp),
|
||||||
|
onClick = onClick,
|
||||||
) {
|
) {
|
||||||
if (isLoading == true) {
|
if (isLoading == true) {
|
||||||
Text("... در حال جستجو" , textAlign = TextAlign.Right)
|
Loading(
|
||||||
|
size = 22.dp,
|
||||||
|
color = MaterialTheme.colorScheme.onPrimary
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Text(text)
|
Text(text)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-6
@@ -11,6 +11,7 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.filled.ArrowBack
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.ArrowForward
|
import androidx.compose.material.icons.filled.ArrowForward
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -19,6 +20,7 @@ import androidx.compose.ui.draw.clip
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.vada.caller.ui.theme.dime
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PaginationControls(
|
fun PaginationControls(
|
||||||
@@ -32,7 +34,7 @@ fun PaginationControls(
|
|||||||
if (totalPages <= 1) return
|
if (totalPages <= 1) return
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier.padding(vertical = 16.dp),
|
modifier = modifier.padding(vertical = MaterialTheme.dime.lg),
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
@@ -49,7 +51,7 @@ fun PaginationControls(
|
|||||||
if (pageRange.first > 1) {
|
if (pageRange.first > 1) {
|
||||||
PageNumberButton(page = 1, isSelected = false, onClick = onPageSelected)
|
PageNumberButton(page = 1, isSelected = false, onClick = onPageSelected)
|
||||||
if (pageRange.first > 2) {
|
if (pageRange.first > 2) {
|
||||||
Text("...", modifier = Modifier.padding(horizontal = 4.dp))
|
Text("...", modifier = Modifier.padding(horizontal = MaterialTheme.dime.xs))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ fun PaginationControls(
|
|||||||
|
|
||||||
if (pageRange.last < totalPages) {
|
if (pageRange.last < totalPages) {
|
||||||
if (pageRange.last < totalPages - 1) {
|
if (pageRange.last < totalPages - 1) {
|
||||||
Text("...", modifier = Modifier.padding(horizontal = 4.dp))
|
Text("...", modifier = Modifier.padding(horizontal = MaterialTheme.dime.xs))
|
||||||
}
|
}
|
||||||
PageNumberButton(page = totalPages, isSelected = false, onClick = onPageSelected)
|
PageNumberButton(page = totalPages, isSelected = false, onClick = onPageSelected)
|
||||||
}
|
}
|
||||||
@@ -89,11 +91,11 @@ private fun PageNumberButton(
|
|||||||
Text(
|
Text(
|
||||||
text = page.toString(),
|
text = page.toString(),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 4.dp)
|
.padding(horizontal = MaterialTheme.dime.xs)
|
||||||
.clip(RoundedCornerShape(4.dp))
|
.clip(RoundedCornerShape(4.dp))
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.clickable { onClick(page) }
|
.clickable { onClick(page) }
|
||||||
.padding(horizontal = 12.dp, vertical = 8.dp),
|
.padding(horizontal = MaterialTheme.dime.md, vertical = MaterialTheme.dime.sm),
|
||||||
color = textColor,
|
color = textColor,
|
||||||
fontSize = 14.sp
|
fontSize = 14.sp
|
||||||
)
|
)
|
||||||
@@ -115,7 +117,7 @@ private fun PaginationButton(
|
|||||||
.size(36.dp)
|
.size(36.dp)
|
||||||
.clip(RoundedCornerShape(4.dp))
|
.clip(RoundedCornerShape(4.dp))
|
||||||
.then(if (enabled) Modifier.clickable(onClick = onClick) else Modifier)
|
.then(if (enabled) Modifier.clickable(onClick = onClick) else Modifier)
|
||||||
.padding(8.dp),
|
.padding(MaterialTheme.dime.sm),
|
||||||
tint = color
|
tint = color
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-18
@@ -114,24 +114,14 @@ fun PharmacyBottomSheet(
|
|||||||
when (val state = pharmacyState) {
|
when (val state = pharmacyState) {
|
||||||
PharmacyState.Loading -> {
|
PharmacyState.Loading -> {
|
||||||
item {
|
item {
|
||||||
Box(
|
Loading(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(400.dp),
|
.height(400.dp),
|
||||||
contentAlignment = Alignment.Center
|
message = "در حال جستجو..."
|
||||||
) {
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
|
||||||
Loading()
|
|
||||||
Spacer(modifier = Modifier.height(MaterialTheme.dime.xl))
|
|
||||||
Text(
|
|
||||||
text = "در حال جستجو...",
|
|
||||||
fontSize = MaterialTheme.typography.bodySmall.fontSize
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
is PharmacyState.Success -> {
|
is PharmacyState.Success -> {
|
||||||
if (state.items.isEmpty()) {
|
if (state.items.isEmpty()) {
|
||||||
@@ -191,7 +181,7 @@ fun PharmacyBottomSheet(
|
|||||||
color = MaterialTheme.colorScheme.error,
|
color = MaterialTheme.colorScheme.error,
|
||||||
fontSize = MaterialTheme.typography.bodyMedium.fontSize
|
fontSize = MaterialTheme.typography.bodyMedium.fontSize
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(MaterialTheme.dime.sm))
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = { viewModel.retry() }) {
|
onClick = { viewModel.retry() }) {
|
||||||
Text("تلاش مجدد")
|
Text("تلاش مجدد")
|
||||||
@@ -243,7 +233,7 @@ fun PharmacyResultItem(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(dime.md),
|
.padding(dime.md),
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
verticalArrangement = Arrangement.spacedBy(dime.xs)
|
||||||
) {
|
) {
|
||||||
// نام برند
|
// نام برند
|
||||||
Text(
|
Text(
|
||||||
@@ -288,19 +278,19 @@ fun PharmacyResultItem(
|
|||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
CircularProgressIndicator(modifier = Modifier.size(24.dp))
|
Loading(size = 24.dp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is PharmacyDetailState.Success -> {
|
is PharmacyDetailState.Success -> {
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(dime.sm)
|
||||||
) {
|
) {
|
||||||
HorizontalDivider(modifier = Modifier.padding(vertical = MaterialTheme.dime.xs))
|
HorizontalDivider(modifier = Modifier.padding(vertical = MaterialTheme.dime.xs))
|
||||||
// آدرس
|
// آدرس
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(dime.sm)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.LocationOn,
|
imageVector = Icons.Default.LocationOn,
|
||||||
@@ -319,7 +309,7 @@ fun PharmacyResultItem(
|
|||||||
if (detailState.detail.phone.isNotBlank()) {
|
if (detailState.detail.phone.isNotBlank()) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(dime.sm)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Phone,
|
imageVector = Icons.Default.Phone,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ fun RetryContent(modifier: Modifier = Modifier , error:String ,onClick:()-> Unit
|
|||||||
Text(
|
Text(
|
||||||
text = error,
|
text = error,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
modifier = Modifier.padding(vertical = 8.dp)
|
modifier = Modifier.padding(vertical = MaterialTheme.dime.sm)
|
||||||
)
|
)
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
text = "تلاش مجدد",
|
text = "تلاش مجدد",
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ fun SearchResultsContent(
|
|||||||
Text(
|
Text(
|
||||||
text = error,
|
text = error,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
modifier = Modifier.padding(vertical = 8.dp)
|
modifier = Modifier.padding(vertical = MaterialTheme.dime.sm)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-15
@@ -12,7 +12,6 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.Divider
|
import androidx.compose.material3.Divider
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -35,6 +34,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import com.approagency.pharmacy.domain.model.DrugDetail
|
import com.approagency.pharmacy.domain.model.DrugDetail
|
||||||
import com.approagency.pharmacy.presentation.common.CustomModalBottomSheet
|
import com.approagency.pharmacy.presentation.common.CustomModalBottomSheet
|
||||||
import com.approagency.pharmacy.presentation.common.ErrorState
|
import com.approagency.pharmacy.presentation.common.ErrorState
|
||||||
|
import com.approagency.pharmacy.presentation.common.Loading
|
||||||
import com.approagency.pharmacy.presentation.viewModel.DrugDetailViewModel
|
import com.approagency.pharmacy.presentation.viewModel.DrugDetailViewModel
|
||||||
import com.approagency.pharmacy.presentation.viewModel.DrugDetailYabState
|
import com.approagency.pharmacy.presentation.viewModel.DrugDetailYabState
|
||||||
import com.vada.caller.ui.theme.LocalDime
|
import com.vada.caller.ui.theme.LocalDime
|
||||||
@@ -80,24 +80,13 @@ fun DrugDetailBottomSheet(
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrugDetailYabState.Loading -> {
|
DrugDetailYabState.Loading -> {
|
||||||
Box(
|
Loading(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(400.dp)
|
.height(400.dp)
|
||||||
.padding(dime.xl),
|
.padding(dime.xl),
|
||||||
contentAlignment = Alignment.Center
|
message = "در حال دریافت اطلاعات دارو..."
|
||||||
) {
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
|
||||||
CircularProgressIndicator(
|
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(dime.md))
|
|
||||||
Text(
|
|
||||||
text = "در حال دریافت اطلاعات دارو...",
|
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is DrugDetailYabState.Success -> {
|
is DrugDetailYabState.Success -> {
|
||||||
@@ -197,7 +186,7 @@ fun DrugDetailContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
drugDetail.therapeuticClass?.let {
|
drugDetail.therapeuticClass?.let {
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
Spacer(modifier = Modifier.height(dime.xs))
|
||||||
Row {
|
Row {
|
||||||
Text(
|
Text(
|
||||||
text = "طبقه درمانی: ",
|
text = "طبقه درمانی: ",
|
||||||
|
|||||||
+5
-17
@@ -17,7 +17,6 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|||||||
import androidx.compose.material.icons.filled.Info
|
import androidx.compose.material.icons.filled.Info
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.Divider
|
import androidx.compose.material3.Divider
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -49,6 +48,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import com.approagency.pharmacy.domain.model.DrugDetail
|
import com.approagency.pharmacy.domain.model.DrugDetail
|
||||||
import com.approagency.pharmacy.presentation.common.ErrorState
|
import com.approagency.pharmacy.presentation.common.ErrorState
|
||||||
|
import com.approagency.pharmacy.presentation.common.Loading
|
||||||
import com.approagency.pharmacy.presentation.viewModel.DrugDetailViewModel
|
import com.approagency.pharmacy.presentation.viewModel.DrugDetailViewModel
|
||||||
import com.approagency.pharmacy.presentation.viewModel.DrugDetailYabState
|
import com.approagency.pharmacy.presentation.viewModel.DrugDetailYabState
|
||||||
import com.vada.caller.ui.theme.LocalDime
|
import com.vada.caller.ui.theme.LocalDime
|
||||||
@@ -122,22 +122,10 @@ fun DrugDetailScreen(
|
|||||||
DrugDetailYabState.Idle -> {}
|
DrugDetailYabState.Idle -> {}
|
||||||
|
|
||||||
DrugDetailYabState.Loading -> {
|
DrugDetailYabState.Loading -> {
|
||||||
Box(
|
Loading(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentAlignment = Alignment.Center
|
message = "در حال دریافت اطلاعات دارو..."
|
||||||
) {
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
|
||||||
CircularProgressIndicator(
|
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
modifier = Modifier.size(48.dp)
|
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(dime.md))
|
|
||||||
Text(
|
|
||||||
text = "در حال دریافت اطلاعات دارو...",
|
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is DrugDetailYabState.Success -> {
|
is DrugDetailYabState.Success -> {
|
||||||
@@ -629,7 +617,7 @@ fun DosageFormsTabContent(drugDetail: DrugDetail) {
|
|||||||
text = "پرخطر",
|
text = "پرخطر",
|
||||||
fontSize = 10.sp,
|
fontSize = 10.sp,
|
||||||
color = Color(0xFFC62828),
|
color = Color(0xFFC62828),
|
||||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
modifier = Modifier.padding(horizontal = 6.dp, vertical = dime.xxs)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,7 +630,7 @@ fun DosageFormsTabContent(drugDetail: DrugDetail) {
|
|||||||
text = "حیاتی",
|
text = "حیاتی",
|
||||||
fontSize = 10.sp,
|
fontSize = 10.sp,
|
||||||
color = Color(0xFF2E7D32),
|
color = Color(0xFF2E7D32),
|
||||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
modifier = Modifier.padding(horizontal = 6.dp, vertical = dime.xxs)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import androidx.compose.ui.text.style.TextAlign
|
|||||||
import androidx.compose.ui.unit.LayoutDirection
|
import androidx.compose.ui.unit.LayoutDirection
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.navigation.NavHostController
|
import androidx.navigation.NavHostController
|
||||||
|
import com.vada.caller.ui.theme.dime
|
||||||
@SuppressLint("ConfigurationScreenWidthHeight")
|
@SuppressLint("ConfigurationScreenWidthHeight")
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -72,7 +73,7 @@ fun RootScreen(navHostController: NavHostController, modifier: Modifier){
|
|||||||
containerColor = MaterialTheme.colorScheme.surface,
|
containerColor = MaterialTheme.colorScheme.surface,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(110.dp).padding(bottom = 2.dp).clip(MaterialTheme.shapes.extraLarge),
|
.height(110.dp).padding(bottom = MaterialTheme.dime.xxs).clip(MaterialTheme.shapes.extraLarge),
|
||||||
tonalElevation = 8.dp, // subtle shadow
|
tonalElevation = 8.dp, // subtle shadow
|
||||||
windowInsets = WindowInsets.navigationBars
|
windowInsets = WindowInsets.navigationBars
|
||||||
.only(WindowInsetsSides.Bottom)
|
.only(WindowInsetsSides.Bottom)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -30,6 +29,7 @@ import com.approagency.pharmacy.presentation.common.CustomTextFilled
|
|||||||
import com.approagency.pharmacy.presentation.common.EmptySearchState
|
import com.approagency.pharmacy.presentation.common.EmptySearchState
|
||||||
import com.approagency.pharmacy.presentation.common.EndOfListIndicator
|
import com.approagency.pharmacy.presentation.common.EndOfListIndicator
|
||||||
import com.approagency.pharmacy.presentation.common.ErrorState
|
import com.approagency.pharmacy.presentation.common.ErrorState
|
||||||
|
import com.approagency.pharmacy.presentation.common.Loading
|
||||||
import com.approagency.pharmacy.presentation.common.LoadingMoreIndicator
|
import com.approagency.pharmacy.presentation.common.LoadingMoreIndicator
|
||||||
import com.approagency.pharmacy.presentation.common.PrimaryButton
|
import com.approagency.pharmacy.presentation.common.PrimaryButton
|
||||||
import com.approagency.pharmacy.presentation.components.DaroYabSearchResult
|
import com.approagency.pharmacy.presentation.components.DaroYabSearchResult
|
||||||
@@ -151,18 +151,10 @@ fun SearchScreen(
|
|||||||
// Results area
|
// Results area
|
||||||
when (val currentState = state) {
|
when (val currentState = state) {
|
||||||
is SearchState.Loading -> {
|
is SearchState.Loading -> {
|
||||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
Loading(
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
modifier = Modifier.fillMaxSize(),
|
||||||
CircularProgressIndicator(
|
message = "در حال جستجو..."
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
Text(
|
|
||||||
text = "در حال جستجو...",
|
|
||||||
modifier = Modifier.padding(top = dime.md),
|
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is SearchState.LoadingMore -> {
|
is SearchState.LoadingMore -> {
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
package com.approagency.pharmacy.ui.theme
|
package com.approagency.pharmacy.ui.theme
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
// رنگهای برنامه در MaterialThemeExt.kt (MedicalColors و ColorScheme ها) تعریف شدهاند.
|
||||||
|
|
||||||
val Purple80 = Color(0xFFD0BCFF)
|
|
||||||
val PurpleGrey80 = Color(0xFFCCC2DC)
|
|
||||||
val Pink80 = Color(0xFFEFB8C8)
|
|
||||||
|
|
||||||
val Purple40 = Color(0xFF6650a4)
|
|
||||||
val PurpleGrey40 = Color(0xFF625b71)
|
|
||||||
val Pink40 = Color(0xFF7D5260)
|
|
||||||
|
|||||||
@@ -12,17 +12,7 @@ val Dana = FontFamily(
|
|||||||
Font(R.font.dana_medium, weight = FontWeight.Medium),
|
Font(R.font.dana_medium, weight = FontWeight.Medium),
|
||||||
Font(R.font.dana_bold, weight = FontWeight.Bold),
|
Font(R.font.dana_bold, weight = FontWeight.Bold),
|
||||||
)
|
)
|
||||||
// Set of Material typography styles to start with
|
// تایپوگرافی برنامه — در DrugTheme استفاده میشود
|
||||||
val Typography = Typography(
|
|
||||||
bodyLarge = TextStyle(
|
|
||||||
fontFamily = FontFamily.Default,
|
|
||||||
fontWeight = FontWeight.Normal,
|
|
||||||
fontSize = 16.sp,
|
|
||||||
lineHeight = 24.sp,
|
|
||||||
letterSpacing = 0.5.sp
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
val AppTypography = Typography(
|
val AppTypography = Typography(
|
||||||
displayLarge = TextStyle(
|
displayLarge = TextStyle(
|
||||||
fontFamily = Dana,
|
fontFamily = Dana,
|
||||||
|
|||||||
Reference in New Issue
Block a user