update:add modification list
This commit is contained in:
137
app/src/main/java/com/aiosman/riderpro/AddModification.kt
Normal file
137
app/src/main/java/com/aiosman/riderpro/AddModification.kt
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.aiosman.riderpro
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.text.BasicTextField
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathEffect
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun EditModification() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color(0xFFf8f8f8))
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.padding(vertical = 16.dp, horizontal = 18.dp)
|
||||
) {
|
||||
NoticeScreenHeader("Modification List")
|
||||
|
||||
}
|
||||
LazyColumn(
|
||||
modifier = Modifier.padding(start = 24.dp, end = 24.dp, top = 16.dp)
|
||||
) {
|
||||
item {
|
||||
repeat(2) {
|
||||
AddModificationItem()
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
}
|
||||
AddModificationButton()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AddModificationItem() {
|
||||
var text by remember { mutableStateOf("") }
|
||||
Column {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.White)
|
||||
.padding(vertical = 13.dp, horizontal = 16.dp),
|
||||
|
||||
|
||||
) {
|
||||
if (text.isEmpty()) {
|
||||
Text("Please enter the name", fontSize = 14.sp, color = Color(0xFFd6d6d6))
|
||||
}
|
||||
BasicTextField(
|
||||
value = text,
|
||||
onValueChange = {
|
||||
text = it
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.align(Alignment.Center)
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(1.dp))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.White)
|
||||
.padding(top = 13.dp, bottom = 13.dp, start = 16.dp, end = 8.dp)
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text("Price", fontSize = 16.sp)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text("$74.00", fontSize = 16.sp, color = Color(0xffda3832))
|
||||
Spacer(modifier = Modifier.width(6.dp))
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.rider_pro_nav_next),
|
||||
contentDescription = "Edit",
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AddModificationButton() {
|
||||
val stroke = Stroke(
|
||||
width = 2f,
|
||||
pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp)
|
||||
.drawBehind {
|
||||
drawRoundRect(color = Color(0xFFd6d6d6), style = stroke)
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
|
||||
contentDescription = "Add",
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.align(Alignment.Center),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,13 @@ fun NavigationController(navController: NavHostController) {
|
||||
NewPostScreen()
|
||||
}
|
||||
}
|
||||
composable(route = "EditModification") {
|
||||
Box(
|
||||
modifier = Modifier.padding(top = 64.dp)
|
||||
) {
|
||||
EditModification()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ fun NewPostScreen() {
|
||||
.fillMaxSize()
|
||||
|
||||
) {
|
||||
|
||||
NewPostTopBar()
|
||||
NewPostTextField("What's on your mind?")
|
||||
AddImageGrid()
|
||||
@@ -153,6 +152,7 @@ fun AddImageGrid() {
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AdditionalPostItem() {
|
||||
val navController = LocalNavController.current
|
||||
var isShowLocationModal by remember { mutableStateOf(false) }
|
||||
fun onSelectLocationClick() {
|
||||
isShowLocationModal = true
|
||||
@@ -202,7 +202,9 @@ fun AdditionalPostItem() {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp, horizontal = 24.dp)
|
||||
.padding(vertical = 16.dp, horizontal = 24.dp).clickable {
|
||||
navController.navigate("EditModification")
|
||||
}
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
|
||||
Reference in New Issue
Block a user