Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Merge branch 'main' into feature-207-button_image_picker-01
Browse files Browse the repository at this point in the history
  • Loading branch information
tinpham5614 authored Nov 30, 2023
2 parents 965a995 + e624783 commit 9201985
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material3.Card
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand All @@ -41,6 +43,7 @@ import com.example.belindas_closet.R
import com.example.belindas_closet.Routes
import com.example.belindas_closet.data.Datasource
import com.example.belindas_closet.model.Product
import com.example.belindas_closet.model.ProductType

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -84,6 +87,9 @@ fun ProductDetailPage(navController: NavController) {
) {
Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu")
}
DropDownCategoryList(drawerState, navController) {
drawerState = DrawerValue.Closed
}
}
)
},
Expand Down Expand Up @@ -158,5 +164,27 @@ fun ProductDetailList(products: List<Product>, navController: NavController) {
}
}
}
@Composable
fun DropDownCategoryList(drawerState: DrawerValue, navController: NavController, onDismissRequest: () -> Unit = {}) {
DropdownMenu(
drawerState == DrawerValue.Open,
onDismissRequest = onDismissRequest,
modifier = Modifier
.padding(8.dp)
) {
ProductType.values().forEach { productType ->
DropdownMenuItem(
text = { Text(productType.type) },
onClick = {
onDismissRequest()
// navigate to product type page
MainActivity.setProductType(productType.type)
navController.navigate(
Routes.ProductDetail.route)
}
)
}
}
}


0 comments on commit 9201985

Please sign in to comment.