Skip to content

Instantly share code, notes, and snippets.

import java.util.*
import android.telephony.TelephonyManager
class Country(
val nameCode: String,
val code: String,
val fullName: String
) {}
fun getFlagEmojiFor(countryCode: String): String {
Box{
TextField(
value = text,
onValueChange = {
text = it
if(!viewModel.isMapEditable.value)
viewModel.onTextChanged(context, text)
},
modifier = Modifier.fillMaxWidth().padding(end = 80.dp),
enabled = !viewModel.isMapEditable.value,
Box(modifier = Modifier.height(500.dp)){
currentLocation.value.let {
MapViewContainer(viewModel.isMapEditable.value, mapView, viewModel)
}
MapPinOverlay()
}
@Composable
fun MapPinOverlay(){
Column(modifier = Modifier.fillMaxWidth()) {
Box(
modifier = Modifier
.weight(1f)
.fillMaxWidth(),
contentAlignment = Alignment.BottomCenter
){
Image(
fun getAddressFromLocation(context: Context): String {
val geocoder = Geocoder(context, Locale.getDefault())
var addresses: List<Address>? = null
val address: Address?
var addressText = ""
try {
addresses = geocoder.getFromLocation(location.value.latitude, location.value.longitude, 1)
}catch(ex: Exception){
ex.printStackTrace()
@Composable
private fun MapViewContainer(
isEnabled: Boolean,
mapView: MapView,
viewModel: MapViewModel
) {
AndroidView(
factory = { mapView }
) {
@Composable
fun CartItemsList(
modifier: Modifier = Modifier,
items: List<CartItem>,
cartItemDispatcher: CartItemDispatcher
) {
LazyColumn(modifier = modifier) {
items(items) { item ->
CartItemView(item, cartItemDispatcher)
}