HI
Please suggest me the options for me to create Business card app.
My code is not aligning the bottom middle row. Please share if anyone has the code to create the sample app. Thank you
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
HappyBirthdayTheme {
Surface(modifier = Modifier.fillMaxSize()) {
Cardb(oneb = stringResource(R.string.jennifer_doe), twob = stringResource(R.string.android_developers_extraordinaire), imageb = painterResource(R.drawable.android_logo),
onebs = "+11(123)444 555 666",
onebi= painterResource(R.drawable.baseline_phone_24),
twobs = "@AndroidDev",
twobi= painterResource(R.drawable.baseline_share_24),
threebs = stringResource (R.string.jen_doe_android_com),
threebi= painterResource(R.drawable.baseline_email_24)
)
}
}
}
}
}
@Composable
fun Cardb(oneb: String, twob: String, imageb: Painter,onebs: String,onebi: Painter,twobs: String,twobi: Painter,threebs: String,threebi: Painter, modifier: Modifier=Modifier) {
Column(Modifier.fillMaxWidth()) {
Row(Modifier.weight(1f)){
Cardbs(oneb = oneb, twob = twob, imageb =imageb )
}
Row(Modifier.weight(1f)) {
Cardbst(onebs = onebs, onebi = onebi, twobs = twobs, twobi = twobi, threebs = threebs, threebi =threebi )
}
}
}
@Composable
fun Cardbs(oneb: String, twob: String, imageb: Painter, modifier: Modifier=Modifier){
Column(Modifier.fillMaxSize(),verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally) {
Box(Modifier.background(color = Color.Black)) {
Image(painter = imageb, contentDescription =null, modifier = Modifier.size(100.dp).align(Alignment.CenterStart).padding(8.dp))
/*Text(text="ANDROID", fontWeight = FontWeight.Bold, color = Color.White, fontSize = 20.sp,modifier = Modifier.align(Alignment.BottomCenter).padding(8.dp))*/
}
Text(text = oneb, fontSize = 32.sp, fontWeight = FontWeight.Bold)
Text(text = twob)
}
}
@Composable
fun Cardbst(onebs: String,onebi: Painter,twobs: String,twobi: Painter,threebs: String,threebi: Painter,modifier: Modifier=Modifier) {
Column(verticalArrangement = Arrangement.Bottom, horizontalAlignment =Alignment.CenterHorizontally, modifier = Modifier.fillMaxSize()) {
Row(horizontalArrangement = Arrangement.Start, verticalAlignment = Alignment.Bottom) {
Image(painter = onebi, contentDescription = null)
Text(text = onebs)
}
Row(horizontalArrangement = Arrangement.Start, verticalAlignment = Alignment.Bottom) {
Image(painter = twobi, contentDescription = null)
Text(text = twobs)
}
Row(horizontalArrangement = Arrangement.Start, verticalAlignment = Alignment.Bottom) {
Image(painter = threebi, contentDescription = null)
Text(text = threebs)
}
}
}