TP-71029 | Saksham Mahajan | Added color in modifier (#11467)

Co-authored-by: saksham <saksham>
This commit is contained in:
Saksham Mahajan
2024-06-19 22:54:49 +05:30
committed by GitHub
parent 5bc7d09eb8
commit e5ca32cb3e
4 changed files with 83 additions and 26 deletions

View File

@@ -8,6 +8,7 @@
package com.naviapp.home.compose.home.navigation
import InvestmentsScreen
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
@@ -15,6 +16,7 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.navi.common.ui.fragment.BaseFragment
import com.naviapp.analytics.utils.NaviAnalytics
@@ -75,7 +77,11 @@ fun NavGraphNavigationItem(
InvestmentsScreen(
activity = activity,
listState = { investmentListState() },
modifier = Modifier.fillMaxSize().padding(bottom = 56.dp).statusBarsPadding(),
modifier =
Modifier.fillMaxSize()
.padding(bottom = 56.dp)
.statusBarsPadding()
.background(Color.White),
sharedVM = sharedVM
)
NavigationItem.Loan.tabId ->

View File

@@ -6,6 +6,7 @@
*/
import android.app.Activity
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@@ -16,7 +17,7 @@ import com.navi.common.ui.errorview.FullScreenErrorComposeView
import com.navi.common.utils.setStatusBarColorInt
import com.navi.design.utils.parseColorSafe
import com.naviapp.home.compose.activity.HomePageActivity
import com.naviapp.home.compose.home.ui.content.HomePageContentShimmer
import com.naviapp.home.dashboard.ui.compose.investmentTab.InvestmentsTabShimmer
import com.naviapp.home.dashboard.viewmodels.InvestmentsVm
import com.naviapp.home.viewmodel.SharedVM
@@ -38,23 +39,24 @@ fun InvestmentsScreen(
sharedVM = sharedVM
)
when (investmentsScreenData) {
is InvestmentsVm.InvestmentsTabUiTronScreenState.Loading -> {
HomePageContentShimmer()
}
is InvestmentsVm.InvestmentsTabUiTronScreenState.Success -> {
InvestmentsTab(
investmentsTabVm = investmentsTabVm,
toggleStatusBarColor = { toggleStatusBarColor(activity, it) },
lazyListState = listState,
modifier = modifier
)
}
is InvestmentsVm.InvestmentsTabUiTronScreenState.Error -> {
FullScreenErrorComposeView(
error = investmentsScreenData.error,
onRetryClick = { investmentsTabVm.fetchInvestmentTabUiTronConfigs() }
)
Box(modifier = modifier) {
when (investmentsScreenData) {
is InvestmentsVm.InvestmentsTabUiTronScreenState.Loading -> {
InvestmentsTabShimmer()
}
is InvestmentsVm.InvestmentsTabUiTronScreenState.Success -> {
InvestmentsTab(
investmentsTabVm = investmentsTabVm,
toggleStatusBarColor = { toggleStatusBarColor(activity, it) },
lazyListState = listState
)
}
is InvestmentsVm.InvestmentsTabUiTronScreenState.Error -> {
FullScreenErrorComposeView(
error = investmentsScreenData.error,
onRetryClick = { investmentsTabVm.fetchInvestmentTabUiTronConfigs() }
)
}
}
}
}

View File

@@ -50,8 +50,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged
fun InvestmentsTab(
investmentsTabVm: InvestmentsVm = hiltViewModel(),
toggleStatusBarColor: (String) -> Unit,
lazyListState: () -> LazyListState?,
modifier: Modifier = Modifier
lazyListState: () -> LazyListState?
) {
val investmentsTabUiTronConfig =
@@ -68,8 +67,7 @@ fun InvestmentsTab(
investmentsTabVm = investmentsTabVm,
data = state.data,
toggleStatusBarColor = toggleStatusBarColor,
lazyListState = lazyListState,
modifier = modifier
lazyListState = lazyListState
)
}
}
@@ -83,8 +81,7 @@ fun RenderWidgets(
investmentsTabVm: InvestmentsVm = hiltViewModel(),
data: ScreenDefinition,
toggleStatusBarColor: (String) -> Unit,
lazyListState: () -> LazyListState? = { null },
modifier: Modifier = Modifier
lazyListState: () -> LazyListState? = { null }
) {
val scrollState = lazyListState() ?: rememberLazyListState()
@@ -102,7 +99,7 @@ fun RenderWidgets(
}
}
Scaffold(
modifier = modifier.fillMaxSize(),
modifier = Modifier.fillMaxSize(),
content = {
CompositionLocalProvider(LocalOverscrollConfiguration provides null) {
LazyColumn(

View File

@@ -0,0 +1,52 @@
/*
*
* * Copyright © 2024 by Navi Technologies Limited
* * All rights reserved. Strictly confidential
*
*/
package com.naviapp.home.dashboard.ui.compose.investmentTab
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
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.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.naviapp.home.utils.shimmerEffect
@Composable
fun InvestmentsTabShimmer() {
Column(modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp)) {
Spacer(modifier = Modifier.height(24.dp))
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
Box(modifier = Modifier.height(34.dp).width(94.dp).shimmerEffect())
Box(modifier = Modifier.height(34.dp).width(148.dp).shimmerEffect())
}
Spacer(modifier = Modifier.height(24.dp))
Box(modifier = Modifier.height(108.dp).fillMaxWidth().shimmerEffect())
Spacer(modifier = Modifier.height(32.dp))
Box(modifier = Modifier.height(24.dp).width(176.dp).shimmerEffect())
Spacer(modifier = Modifier.height(24.dp))
Box(modifier = Modifier.height(132.dp).fillMaxWidth().shimmerEffect())
Spacer(modifier = Modifier.height(32.dp))
Box(modifier = Modifier.height(24.dp).width(120.dp).shimmerEffect())
Spacer(modifier = Modifier.height(24.dp))
Box(modifier = Modifier.height(104.dp).fillMaxWidth().shimmerEffect())
Spacer(modifier = Modifier.height(24.dp))
Box(modifier = Modifier.height(78.dp).fillMaxWidth().shimmerEffect())
Spacer(modifier = Modifier.height(32.dp))
Box(modifier = Modifier.height(24.dp).width(176.dp).shimmerEffect())
Spacer(modifier = Modifier.height(24.dp))
Box(modifier = Modifier.height(132.dp).fillMaxWidth().shimmerEffect())
}
}