This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun CartItemsList( | |
modifier: Modifier = Modifier, | |
items: List<CartItem>, | |
cartItemDispatcher: CartItemDispatcher | |
) { | |
LazyColumn(modifier = modifier) { | |
items(items) { item -> | |
CartItemView(item, cartItemDispatcher) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun MapViewContainer( | |
isEnabled: Boolean, | |
mapView: MapView, | |
viewModel: MapViewModel | |
) { | |
AndroidView( | |
factory = { mapView } | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun MapPinOverlay(){ | |
Column(modifier = Modifier.fillMaxWidth()) { | |
Box( | |
modifier = Modifier | |
.weight(1f) | |
.fillMaxWidth(), | |
contentAlignment = Alignment.BottomCenter | |
){ | |
Image( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Box(modifier = Modifier.height(500.dp)){ | |
currentLocation.value.let { | |
MapViewContainer(viewModel.isMapEditable.value, mapView, viewModel) | |
} | |
MapPinOverlay() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
import android.telephony.TelephonyManager | |
class Country( | |
val nameCode: String, | |
val code: String, | |
val fullName: String | |
) {} | |
fun getFlagEmojiFor(countryCode: String): String { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun AppTextField( | |
modifier: Modifier = Modifier, | |
text: String, | |
placeholder: String, | |
leadingIcon: @Composable (() -> Unit)? = null, | |
onChange: (String) -> Unit = {}, | |
imeAction: ImeAction = ImeAction.Next, | |
keyboardType: KeyboardType = KeyboardType.Text, | |
keyBoardActions: KeyboardActions = KeyboardActions(), | |
isEnabled: Boolean = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FormViewModel : ViewModel() { | |
var firstName by mutableStateOf("") | |
var lastName by mutableStateOf("") | |
var password by mutableStateOf("") | |
var mobileNumber by mutableStateOf("") | |
var mobileCountryCode by mutableStateOf("") | |
var dateOfBirth by mutableStateOf("") | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//User name text field | |
Column{ | |
val focusManager = LocalFocusManager.current | |
AppTextField( | |
text = viewModel.firstName, | |
placeholder = "First Name", | |
onChange = { | |
viewModel.firstName = it | |
}, |
OlderNewer