add: Tugas 4 Name Card Indris Alpasela

This commit is contained in:
202310715200 INDRIS ALPASELA 2025-10-30 14:37:40 +07:00
parent cc504c458e
commit dd90279cfc
2 changed files with 27 additions and 11 deletions

View File

@ -1,5 +1,6 @@
//NAMA : INDRIS ALPASELA
//NPM : 202310715200
package com.example.helloworld2
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
@ -15,10 +16,12 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.helloworld2.ui.theme.HelloWorld2Theme
import androidx.compose.foundation.Image
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -39,7 +42,6 @@ class MainActivity : ComponentActivity() {
@Composable
fun GreetingScreen(name: String) {
// Background gradasi warna
Box(
modifier = Modifier
.fillMaxSize()
@ -50,7 +52,6 @@ fun GreetingScreen(name: String) {
),
contentAlignment = Alignment.Center
) {
// Card di tengah
Card(
modifier = Modifier
.padding(20.dp)
@ -66,6 +67,16 @@ fun GreetingScreen(name: String) {
.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
) {
// 🖼️ Tambah gambar di atas teks
Image(
painter = painterResource(id = R.drawable.profile),
contentDescription = "Profile Picture",
modifier = Modifier
.size(120.dp)
.padding(bottom = 16.dp)
.clip(RoundedCornerShape(60.dp))
)
Text(
text = "Hello, $name 👋",
fontSize = 28.sp,
@ -80,15 +91,20 @@ fun GreetingScreen(name: String) {
color = Color.Gray,
textAlign = TextAlign.Center
)
Text(
text = "Email : indris.alpasela06@gmail.com",
fontSize = 16.sp,
color = Color.Gray,
textAlign = TextAlign.Center
)
Text(
text = "No HP : 081219269099",
fontSize = 16.sp,
color = Color.Gray,
textAlign = TextAlign.Center
)
}
}
}
}
@Preview(showBackground = true, showSystemUi = true)
@Composable
fun GreetingPreview() {
HelloWorld2Theme {
GreetingScreen("Android Dev")
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB