feat: implement profile screen

This commit is contained in:
Cutiful 2025-05-19 21:23:26 +07:00
parent a58fb72209
commit ae6e0a31db
7 changed files with 212 additions and 5 deletions

View File

@ -1,5 +1,40 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" module="true" />
<package name="android" withSubpackages="true" static="true" />
<package name="androidx" withSubpackages="true" static="true" />
<package name="com" withSubpackages="true" static="true" />
<package name="junit" withSubpackages="true" static="true" />
<package name="net" withSubpackages="true" static="true" />
<package name="org" withSubpackages="true" static="true" />
<package name="java" withSubpackages="true" static="true" />
<package name="javax" withSubpackages="true" static="true" />
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="android" withSubpackages="true" static="false" />
<emptyLine />
<package name="androidx" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="junit" withSubpackages="true" static="false" />
<emptyLine />
<package name="net" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
<emptyLine />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings> </JetCodeStyleSettings>

View File

@ -15,7 +15,7 @@ android {
applicationId = "com.syaroful.agrilinkvocpro" applicationId = "com.syaroful.agrilinkvocpro"
minSdk = 29 minSdk = 29
targetSdk = 35 targetSdk = 35
versionCode = 2 versionCode = 3
versionName = "1.0.0" versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View File

@ -50,8 +50,8 @@ val textTheme = Typography(
letterSpacing = 0.sp, letterSpacing = 0.sp,
), ),
titleMedium = TextStyle( titleMedium = TextStyle(
fontWeight = FontWeight.W400, fontWeight = FontWeight.W500,
fontSize = 16.sp, fontSize = 18.sp,
lineHeight = 24.sp, lineHeight = 24.sp,
letterSpacing = 0.1.sp, letterSpacing = 0.1.sp,
), ),

View File

@ -1,4 +1,4 @@
package com.syaroful.agrilinkvocpro.ui.pages package com.syaroful.agrilinkvocpro.ui.screen.login
import android.content.res.Configuration.UI_MODE_NIGHT_YES import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.Image import androidx.compose.foundation.Image

View File

@ -0,0 +1,173 @@
package com.syaroful.agrilinkvocpro.ui.screen.profile
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.syaroful.agrilinkvocpro.R
import com.syaroful.agrilinkvocpro.core.components.textTheme
import com.syaroful.agrilinkvocpro.ui.theme.AgrilinkVocproTheme
import com.syaroful.agrilinkvocpro.ui.theme.LightGrey
import com.syaroful.agrilinkvocpro.ui.theme.MainGreen
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ProfileScreen() {
Scaffold(
topBar = {
TopAppBar(
title = {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()
) {
Text("Profile", style = MaterialTheme.typography.titleMedium)
}
},
navigationIcon = {
IconButton(onClick = { }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
}
},
)
}
) { innerPadding ->
Column(
modifier = Modifier
.padding(innerPadding)
.padding(horizontal = 20.dp)
) {
Text(text = "Akun", style = textTheme.titleMedium)
Column(
modifier = Modifier
.padding(vertical = 16.dp)
.border(
width = 1.dp,
color = MainGreen.copy(alpha = 0.1f),
shape = RoundedCornerShape(8.dp)
)
.padding(8.dp)
) {
RowItemWidget(
label = "Nama",
value = "Muhamad Syaroful Anam"
)
RowItemWidget(
label = "Username",
value = "syaroful"
)
RowItemWidget(
label = "Email",
value = "syaroful@gamil.com"
)
RowItemWidget(
label = "No. Telepon",
value = "08123456789"
)
}
Text(text = "Informasi", style = textTheme.titleMedium)
Column(
modifier = Modifier
.padding(vertical = 16.dp)
.border(
width = 1.dp,
color = MainGreen.copy(alpha = 0.1f),
shape = RoundedCornerShape(8.dp)
)
.padding(8.dp)
) {
RowItemWidgetWithIcon(
label = "Syarat dan Ketentuan",
icon = painterResource(id = R.drawable.ic_doc)
)
RowItemWidgetWithIcon(
label = "FAQ",
icon = painterResource(id = R.drawable.ic_question)
)
RowItemWidgetWithIcon(
label = "Kebijakan Privasi",
icon = painterResource(id = R.drawable.ic_shield)
)
RowItemWidgetWithIcon(
label = "Log Out",
icon = painterResource(id = R.drawable.ic_out)
)
}
}
}
}
@Composable
private fun RowItemWidgetWithIcon(
label: String,
icon: Painter,
onClick: () -> Unit = {}
) {
Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onClick() }
.padding(horizontal = 8.dp)
.padding(vertical = 10.dp)) {
Image(
modifier = Modifier.width(24.dp),
painter = icon,
contentDescription = label,
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = label
)
}
}
@Composable
private fun RowItemWidget(
label: String,
value: String
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(text = label)
Text(text = value, color = LightGrey)
}
}
@Preview(showBackground = true, name = "Light Mode")
@Preview(showBackground = true, name = "Dark Mode", uiMode = UI_MODE_NIGHT_YES)
@Composable
fun ProfilePreview() {
AgrilinkVocproTheme {
ProfileScreen()
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -12,5 +12,4 @@
<string name="download">Download</string> <string name="download">Download</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="title_activity_control_actuator">ControlActuatorActivity</string> <string name="title_activity_control_actuator">ControlActuatorActivity</string>
</resources> </resources>