111 lines
3.7 KiB
Kotlin
111 lines
3.7 KiB
Kotlin
//NAMA : INDRIS ALPASELA
|
|
//NPM : 202310715200
|
|
package com.example.helloworld2
|
|
import android.os.Bundle
|
|
import androidx.activity.ComponentActivity
|
|
import androidx.activity.compose.setContent
|
|
import androidx.activity.enableEdgeToEdge
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.layout.*
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
import androidx.compose.material3.*
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Modifier
|
|
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.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?) {
|
|
super.onCreate(savedInstanceState)
|
|
enableEdgeToEdge()
|
|
setContent {
|
|
HelloWorld2Theme {
|
|
Surface(
|
|
modifier = Modifier.fillMaxSize(),
|
|
color = MaterialTheme.colorScheme.background
|
|
) {
|
|
GreetingScreen(name = "Indris Alpasela")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Composable
|
|
fun GreetingScreen(name: String) {
|
|
Box(
|
|
modifier = Modifier
|
|
.fillMaxSize()
|
|
.background(
|
|
Brush.verticalGradient(
|
|
colors = listOf(Color(0xFF0D47A1), Color(0xFF1976D2), Color(0xFF42A5F5))
|
|
)
|
|
),
|
|
contentAlignment = Alignment.Center
|
|
) {
|
|
Card(
|
|
modifier = Modifier
|
|
.padding(20.dp)
|
|
.fillMaxWidth()
|
|
.wrapContentHeight(),
|
|
colors = CardDefaults.cardColors(containerColor = Color.White.copy(alpha = 0.95f)),
|
|
shape = RoundedCornerShape(24.dp),
|
|
elevation = CardDefaults.cardElevation(12.dp)
|
|
) {
|
|
Column(
|
|
modifier = Modifier
|
|
.padding(24.dp)
|
|
.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,
|
|
fontWeight = FontWeight.Bold,
|
|
color = Color(0xFF0D47A1),
|
|
textAlign = TextAlign.Center
|
|
)
|
|
Spacer(modifier = Modifier.height(12.dp))
|
|
Text(
|
|
text = "NPM : 202310715200",
|
|
fontSize = 16.sp,
|
|
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
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|