Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsrk committed Jan 21, 2023
1 parent 1bb83c6 commit 640f367
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedCard
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -52,7 +52,7 @@ fun ProfileScreen(navController: NavController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Profile", style = MaterialTheme.typography.headlineLarge)
OutlinedCard(
Card(
Modifier.fillMaxWidth()
) {
Column(
Expand Down Expand Up @@ -98,6 +98,19 @@ fun ProfileScreen(navController: NavController) {
onValueChange = { }
)
}
Row(
Modifier
.fillMaxWidth()
.padding(5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(text = "Student ID: ")
OutlinedTextField(
value = "",
onValueChange = { }
)
}
Row(
Modifier
.fillMaxWidth()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material3.OutlinedCard
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Card
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -20,16 +21,31 @@ fun RechargeScreen(navController: NavController) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column() {
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
OutlinedCard(Modifier.height(200.dp)) {
Card(
Modifier
.height(200.dp)
.width(200.dp)
) {
Text("Low package")
}
OutlinedCard(Modifier.height(200.dp)) {
Card(
Modifier
.height(200.dp)
.width(200.dp)
) {
Text("Medium package")
}
}

Row(horizontalArrangement = Arrangement.Center) {
OutlinedCard {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center,
) {
Card(
Modifier
.height(200.dp)
.width(200.dp)
) {
Text("High package")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ import com.google.android.gms.location.LocationServices
fun ScanScreen(navController: NavController) {
var code by remember { mutableStateOf("") }
var isExpanded by remember { mutableStateOf(false) }
var isToExpanded by remember { mutableStateOf(false) }
val context = LocalContext.current
val lifeCycleOwner = LocalLifecycleOwner.current
val listItems = listOf("Dhaka", "Savar")
val fromList = mutableListOf("Dhaka", "Savar")
val toList = mutableListOf("Dhaka", "Savar")
val busList = listOf("Thikana", "Itihas")
var selectedItem by remember { mutableStateOf("Dhaka") }
toList.remove(selectedItem)
var selectedToItem = toList[0]
var initialLocation = LocationServices.getFusedLocationProviderClient(context)
val icon = if (isExpanded)
Icons.Filled.KeyboardArrowUp
Expand Down Expand Up @@ -137,7 +141,7 @@ fun ScanScreen(navController: NavController) {
modifier = Modifier
.width(with(LocalDensity.current) { textFieldSize.width.toDp() })
) {
listItems.forEach { label ->
fromList.forEach { label ->
DropdownMenuItem(
onClick = {
selectedItem = label
Expand All @@ -149,6 +153,43 @@ fun ScanScreen(navController: NavController) {
}

}
Row {
OutlinedTextField(
value = selectedToItem,
onValueChange = { selectedToItem = it },
enabled = false,
modifier = Modifier
.fillMaxWidth()
.onGloballyPositioned { coordinates ->
//This value is used to assign to the DropDown the same width
textFieldSize = coordinates.size.toSize()
}
.clickable { isToExpanded = !isToExpanded },

label = { Text("To") },
trailingIcon = {
Icon(icon, "contentDescription",
Modifier.clickable { isToExpanded = !isToExpanded })
}
)
DropdownMenu(
expanded = isToExpanded,
onDismissRequest = { isToExpanded = false },
modifier = Modifier
.width(with(LocalDensity.current) { textFieldSize.width.toDp() })
) {
toList.forEach { label ->
DropdownMenuItem(
onClick = {
selectedToItem = label
isToExpanded = !isToExpanded
},
text = { Text(text = label) }
)
}
}

}
}
}
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,41 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Card
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import com.example.buspayment.navigations.Screens

@Composable
fun UserHistoryScreen(navController: NavController) {
Box(Modifier.fillMaxSize()) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column {
Text(text = "Recharge", Modifier.clickable {
navController.navigate(Screens.UHome.route)
})
Card(
Modifier
.height(400.dp)
.width(400.dp)
) {

Text(
text = "History",
textAlign = TextAlign.Center,
style = MaterialTheme.typography.headlineLarge,
modifier = Modifier
.clickable {
navController.navigate(Screens.UHome.route)
}
.fillMaxWidth()
)
}
}
}
}

0 comments on commit 640f367

Please sign in to comment.