BM Def Bottomcontent
BM Def Bottomcontent
Modifier
.background(MaterialTheme.colorScheme.background)
.fillMaxWidth()
.fillMaxHeight(0.95f),
horizontalAlignment = Alignment.CenterHorizontally,
) {
val successState = state as? DashboardScreenUISate.Success
Box(
Modifier.fillMaxWidth()
.wrapContentHeight(),
contentAlignment = Alignment.TopCenter
) {
gifAdsState.gifAds.let {
if (it.isNotEmpty()) {
androidx.compose.animation.AnimatedVisibility(
showBannerBox,
enter = slideInVertically {
(it / 2)
},
exit = fadeOut(animationSpec = tween(durationMillis = 0))
) {
OfferBannerContent(
Modifier
.zIndex(1f)
.offset(y = -(MaterialTheme.spacing.small)),
it.first().url
)
}
} else if (gifAdsState.showBonusAd) {
androidx.compose.animation.AnimatedVisibility(
showBannerBox,
enter = slideInVertically {
(it / 2)
},
exit = fadeOut(animationSpec = tween(durationMillis = 0))
) {
BonusBanner(
modifier = Modifier
.zIndex(1f)
.offset(y = -(MaterialTheme.spacing.small))
)
}
}
}
CustomAppSheetHandle(
Modifier.fillMaxWidth()
.clip(
RoundedCornerShape(
topStart = MaterialTheme.spacing.large,
topEnd = MaterialTheme.spacing.large
)
)
.background(MaterialTheme.colorScheme.background)
.align(Alignment.BottomCenter)
)
}
LazyColumn(
Modifier.fillMaxWidth()
.padding(horizontal = if (isCompact) MaterialTheme.spacing.large
else MaterialTheme.spacing.mSLarge),
verticalArrangement =
Arrangement.spacedBy(MaterialTheme.spacing.large),
horizontalAlignment = Alignment.CenterHorizontally,
) {
item {
DashboardWhereToItem(
onWhereToClick = {
if (isRentalCarSelected) {
onDashboardClick(DashboardClickEvent.RentalWhereToClick)
} else {
onDashboardClick(DashboardClickEvent.WhereToClick)
}
},
onQRCodeClick =
{ onDashboardClick(DashboardClickEvent.OnQRCodeClick) },
isRentalSelected = isRentalCarSelected
)
}
item {
AnimatedVisibility(showBannerBox) {
Column(
Modifier.fillMaxWidth(),
) {
LazyRow(
Modifier.fillMaxWidth(),
horizontalArrangement =
Arrangement.spacedBy(MaterialTheme.spacing.xLarge)
) {
items(gridList) { dashboardItems ->
ServiceListItem(
icon = dashboardItems.icon,
title = dashboardItems.title,
onAssistChipClick = {
isRentalCarSelected =
dashboardItems.title == rentalTitle
isPackageSelected =
dashboardItems.title == packageTitle
isTravelSelected =
dashboardItems.title == travelTitle
successState?.currentItem?.value =
dashboardItems
successState?.isRentalCar?.value =
isRentalCarSelected
if (isRentalCarSelected) {
onDashboardClick(DashboardClickEvent.RentalCarClick)
} else if (isPackageSelected) {
onDashboardClick(DashboardClickEvent.OnPackageClick)
} else if (isTravelSelected) {
onDashboardClick(DashboardClickEvent.OnTravelClick)
} else {
onDashboardClick(DashboardClickEvent.DeliveryClick)
}
},
borderColor = if
(successState?.currentItem?.value == dashboardItems && isRentalCarSelected)
MaterialTheme.colorScheme.primary
else
Color.Transparent,
cardContainerColor = if
(successState?.currentItem?.value == dashboardItems && isRentalCarSelected)
RiderApp.lightGreen
else
RiderApp.ContainerColor
)
}
}
}
}
AnimatedVisibility(showBannerBox.not()) {
Column {
gridList.chunked(4).forEach {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement =
Arrangement.spacedBy(MaterialTheme.spacing.large)
) {
it.forEach { gridItem ->
ServiceListItem(
modifier = Modifier.weight(1f),
icon = gridItem.icon,
title = gridItem.title,
onAssistChipClick = {
isRentalCarSelected =
gridItem.title == rentalTitle
isPackageSelected =
gridItem.title == packageTitle
isTravelSelected =
gridItem.title == travelTitle
successState?.currentItem?.value =
gridItem
successState?.isRentalCar?.value =
isRentalCarSelected
if (isRentalCarSelected) {
onDashboardClick(DashboardClickEvent.RentalCarClick)
} else if (isPackageSelected) {
onDashboardClick(DashboardClickEvent.OnPackageClick)
} else if (isTravelSelected) {
onDashboardClick(DashboardClickEvent.OnTravelClick)
} else {
onDashboardClick(DashboardClickEvent.DeliveryClick)
}
},
borderColor = if
(successState?.currentItem?.value == gridItem && isRentalCarSelected)
MaterialTheme.colorScheme.primary
else
Color.Transparent,
cardContainerColor = if
(successState?.currentItem?.value == gridItem && isRentalCarSelected)
RiderApp.lightGreen
else
RiderApp.ContainerColor
)
}
}
MaterialTheme.spacing.large.VerticalSpacing()
}
}
}
}
item {
if (isRentalCarSelected) {
AnimatedVisibility(
visible = isRentalCarSelected,
enter = enterTransition(),
exit = fadeOut(animationSpec = tween(durationMillis = 500))
) {
PopularDestinationBody(
popularDestinationList = popularDestinationList,
onItemClick = {
navigatePopularDestinationToCreateBooking(
viewModel.uiState.value,
navigator
)
}
)
}
}
}
if (successState?.visitedAreas.isNullOrEmpty()) {
item {
if (isCompact) {
MaterialTheme.spacing.medium.VerticalSpacing()
} else {
MaterialTheme.spacing.smLarge.VerticalSpacing()
}
}
}
successState?.visitedAreas?.let {
if (successState.visitedAreas.isNotEmpty()) {
items(successState.visitedAreas) { va ->
DefaultLocationItem(
text = va.destinationAddress,
subtext = va.featuredDestinationAddress,
showDivider = successState.visitedAreas.last() != va,
onClick = {
if (successState.userRideLatLong != null) {
navigator.push(
CreateBookingScreen(
destination = Destination(
pickupPoint =
successState.userRideLatLong,
dropOffPoint = RideLatLong(
long = va.longitude.toDouble(),
lat = va.latitude.toDouble(),
address = va.destinationAddress
),
),
hasLuggage =
successState.userRideLatLong.address.isPresentInList(
Constants.AIRPORT_KEYWORDS
) ||
va.destinationAddress.isPresentInList(
Constants.AIRPORT_KEYWORDS
)
)
)
}
}
)
}
}
}
if (successState?.showSpinWin == true) {
item {
MaterialTheme.spacing.standard.VerticalSpacing()
WheelSpinCard(
title = stringResource(Res.string.spin_wheel_to_win),
subTitle = stringResource(Res.string.feres_miles_points),
buttonText = stringResource(Res.string.spin_and_win),
wheelImage = Res.drawable.wheel,
onClick = {
navigator.push(MySpinScreen())
}
)
}
item {
WheelSpinCard(
title = stringResource(Res.string.shake_phone_win),
subTitle = stringResource(Res.string.feres_miles_points),
buttonText = stringResource(Res.string.shake_win),
wheelImage = Res.drawable.shake_to_win,
onClick = {
navigator.push(MySpinScreen())
}
)
MaterialTheme.spacing.standard.VerticalSpacing()
}
}
}
}