Skip to content

Commit

Permalink
refactor: colors, spacer
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagarjuna0033 committed Feb 26, 2025
1 parent 9bdf418 commit 791896b
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 35 deletions.
5 changes: 5 additions & 0 deletions cmp-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ kotlin {
implementation(libs.koin.compose)
implementation(libs.koin.compose.viewmodel)
}
androidMain.dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.tracing.ktx)
implementation(libs.koin.android)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.koin.core.context.GlobalContext

actual fun callHelpline() {
val context: Context = GlobalContext.get().get()
// val context = androidContext()
val intent = Intent(Intent.ACTION_DIAL).apply {
data = Uri.parse("tel:8000000000")
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ internal fun FeatureNavHost(
) {
homeNavGraph(
onNavigate = { handleHomeNavigation(appState.navController, it, onClickLogout) },
// onNavigate = { handleHomeNavigation(it, onClickLogout) },
callHelpline = { callHelpline() },
mailHelpline = { mailHelpline() },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fun MifosScaffold(
}
},
snackbarHost = snackbarHost,
containerColor = Color.Transparent,
containerColor = MaterialTheme.colorScheme.background,
content = { paddingValues ->
val internalPullToRefreshState = rememberPullToRefreshState()
Box(
Expand Down Expand Up @@ -105,7 +105,7 @@ fun MifosScaffold(
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() },
pullToRefreshState: MifosPullToRefreshState = rememberMifosPullToRefreshState(),
floatingActionButtonPosition: FabPosition = FabPosition.End,
containerColor: Color = Color.Transparent,
containerColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = MaterialTheme.colorScheme.onSurface,
contentWindowInsets: WindowInsets = ScaffoldDefaults.contentWindowInsets,
content: @Composable (PaddingValues) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/
package org.mifos.mobile.feature.home.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
Expand Down Expand Up @@ -51,7 +52,10 @@ internal fun HomeNavigationDrawer(
modifier = modifier,
drawerContent = {
ModalDrawerSheet {
LazyColumn {
LazyColumn(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
item {
MifosUserImage(
modifier = Modifier
Expand All @@ -63,19 +67,15 @@ internal fun HomeNavigationDrawer(
Text(
text = username,
style = MaterialTheme.typography.headlineSmall,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier
.padding(horizontal = 20.dp)
.fillMaxWidth(1f),
)

Spacer(modifier = Modifier.height(20.dp))
}

items(
items = HomeNavigationItems.entries.toTypedArray(),
itemContent = { item ->
Spacer(modifier = Modifier.height(12.dp))
NavigationDrawerItem(
modifier = Modifier.padding(horizontal = 20.dp),
label = {
Expand All @@ -92,7 +92,6 @@ internal fun HomeNavigationDrawer(
selected = item == HomeNavigationItems.Home,
onClick = { navigateItem(item) },
)
Spacer(modifier = Modifier.height(12.dp))
if (item == HomeNavigationItems.ManageBeneficiaries) {
HorizontalDivider(
modifier = Modifier.padding(horizontal = 20.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
package org.mifos.mobile.feature.home.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand All @@ -23,7 +22,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import mifos_mobile.feature.home.generated.resources.Res
Expand Down Expand Up @@ -63,14 +61,12 @@ internal fun HomeTopBar(
Box(
modifier = Modifier
.clip(CircleShape)
.background(Color.Red)
.padding(2.dp)
.size(8.dp),
contentAlignment = Alignment.Center,
) {
Text(
text = notificationCount.toString(),
color = Color.White,
fontSize = 6.sp,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
package org.mifos.mobile.feature.home.components

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
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.padding
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.Card
Expand Down Expand Up @@ -47,6 +46,7 @@ internal fun TransferDialog(
modifier = Modifier
.fillMaxWidth()
.padding(all = 20.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = stringResource(Res.string.transfer),
Expand All @@ -56,9 +56,7 @@ internal fun TransferDialog(
navigateToTransfer()
},
)
Spacer(modifier = Modifier.height(20.dp))
HorizontalDivider()
Spacer(modifier = Modifier.height(20.dp))
Text(
text = stringResource(Res.string.third_party_transfer),
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ 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.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -61,6 +58,7 @@ import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.stringResource
import org.jetbrains.compose.ui.tooling.preview.Preview
import org.mifos.mobile.core.common.CurrencyFormatter
import org.mifos.mobile.core.designsystem.component.MifosCard
import org.mifos.mobile.core.designsystem.component.MifosScaffold
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
import org.mifos.mobile.core.ui.component.MifosHiddenTextRow
Expand Down Expand Up @@ -132,24 +130,21 @@ private fun HomeScreenContent(
.fillMaxSize()
.padding(horizontal = 16.dp)
.verticalScroll(scrollState),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
UserDetailsRow(
username = state.username,
userBitmap = state.image,
userProfile = { onAction(HomeAction.OnNavigate(HomeDestinations.PROFILE)) },
)

Spacer(modifier = Modifier.height(8.dp))

AccountOverviewCard(
totalLoanAmount = state.loanAmount,
totalSavingsAmount = state.savingsAmount,
totalLoan = { onAction(HomeAction.OnNavigate(HomeDestinations.LOAN_ACCOUNT)) },
totalSavings = { onAction(HomeAction.OnNavigate(HomeDestinations.SAVINGS_ACCOUNT)) },
)

Spacer(modifier = Modifier.height(8.dp))

state.homeCardItems?.let {
HomeCards(
homeCards = it,
Expand Down Expand Up @@ -234,7 +229,6 @@ private fun UserDetailsRow(
Text(
text = stringResource(Res.string.hello_client, username),
style = MaterialTheme.typography.headlineSmall,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier
.padding(horizontal = 20.dp)
.fillMaxWidth(1f),
Expand Down Expand Up @@ -264,13 +258,11 @@ private fun HomeCard(
imageVector = imageVector,
contentDescription = null,
modifier = Modifier.size(48.dp),
tint = MaterialTheme.colorScheme.primary,
)
Text(
text = stringResource(titleId),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface,
)
}
}
Expand All @@ -286,20 +278,19 @@ private fun AccountOverviewCard(
val isInPreview = LocalInspectionMode.current

Row {
Card(
MifosCard(
modifier = Modifier
.fillMaxWidth(),
colors = CardDefaults.cardColors(),
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
text = stringResource(Res.string.accounts_overview),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface,
)

HorizontalDivider(modifier = Modifier.padding(top = 8.dp, bottom = 4.dp))
Expand All @@ -322,8 +313,6 @@ private fun AccountOverviewCard(
onClick = totalSavings,
)

Spacer(modifier = Modifier.height(8.dp))

MifosHiddenTextRow(
title = stringResource(Res.string.total_loan),
hiddenText = if (isInPreview) {
Expand Down Expand Up @@ -360,7 +349,6 @@ private fun ContactUsRow(
Text(
text = stringResource(Res.string.need_help),
modifier = Modifier.weight(1f),
color = MaterialTheme.colorScheme.onSurface,
style = MaterialTheme.typography.bodyMedium,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ private fun HomeScreenDialog(

is HomeState.DialogState.Loading -> MifosProgressIndicator(modifier = Modifier.fillMaxSize())

null -> Unit
is HomeState.DialogState.LogoutConfirmationDialog -> {
MifosAlertDialog(
onDismissRequest = { onAction(HomeAction.OnDismissDialog) },
Expand All @@ -95,6 +94,7 @@ private fun HomeScreenDialog(
dialogText = "",
)
}
null -> Unit
}
}

Expand Down

0 comments on commit 791896b

Please sign in to comment.