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

Enhancement 97 product navigation 01 #136

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ android {

dependencies {

implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.22')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.8.0'
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
Expand All @@ -65,7 +65,7 @@ dependencies {
debugImplementation 'androidx.compose.ui:ui-test-manifest'

// Navigation
implementation 'androidx.navigation:navigation-compose:2.6.0'
implementation 'androidx.navigation:navigation-compose:2.7.5'

// Material Design
implementation "androidx.compose.material3:material3:1.2.0-alpha03"
Expand All @@ -85,4 +85,5 @@ dependencies {

// Kotlin Reflection
implementation "org.jetbrains.kotlin:kotlin-reflect:1.8.22"

}
30 changes: 15 additions & 15 deletions app/src/main/java/com/example/belindas_closet/screen/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ fun HomePage(navController: NavController) {
)
Spacer(modifier = Modifier.padding(16.dp))

// Add Product button (Temporary),
// todo: will later be moved and protected for only admin access
Button(
onClick = {
/*TODO add navigation logic to the protected page only allowing Admin access*/
navController.navigate(Routes.AddProduct.route)
},
modifier = Modifier
.padding(4.dp)
.align(Alignment.CenterHorizontally)
) {
Text(text = "Add Product")
}
// Add Product button (Temporary),
// todo: will later be moved and protected for only admin access
Button(
onClick = {
/*TODO add navigation logic to the protected page only allowing Admin access*/
navController.navigate(Routes.AddProduct.route)
},
modifier = Modifier
.padding(4.dp)
.align(Alignment.CenterHorizontally)
) {
Text(text = "Add Product")
}
// TODO Delete later. Just for testing purpose
TextButton(
onClick = {
Expand Down Expand Up @@ -195,5 +195,5 @@ fun NSCLogo() {
Image(
painter = painterResource(id = R.drawable.nsc_v_logo),
contentDescription = stringResource(id = R.string.home_nsc_logo_description)
)
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,29 @@ import com.example.belindas_closet.R
import com.example.belindas_closet.Routes
import com.example.belindas_closet.model.Product
import com.example.belindas_closet.data.Datasource
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material3.*
import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
import androidx.compose.runtime.*

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun IndividualProductPage(navController: NavController, productId: String) {

var drawerState by remember { mutableStateOf(DrawerValue.Closed) }

Scaffold(

modifier = Modifier
.fillMaxSize(),
topBar = {
/* Back arrow that navigates back to login page */
TopAppBar(
title = { Text("Home") },
title = { Text("Back") },
navigationIcon = {
IconButton(
onClick = {
Expand All @@ -55,7 +67,7 @@ fun IndividualProductPage(navController: NavController, productId: String) {
) {
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "Back to Home page"
contentDescription = "Back to Product page"
)
}
},
Expand All @@ -67,6 +79,13 @@ fun IndividualProductPage(navController: NavController, productId: String) {
) {
Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit")
}
IconButton(
onClick = {
drawerState = DrawerValue.Open
}
) {
Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu")
}
}
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
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
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.rememberDrawerState
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.graphics.Color
Expand All @@ -44,6 +53,9 @@ import com.example.belindas_closet.data.Datasource
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ProductDetailPage(navController: NavController) {

var drawerState by remember { mutableStateOf(DrawerValue.Closed) }

Scaffold(
modifier = Modifier
.fillMaxSize(),
Expand Down Expand Up @@ -74,9 +86,18 @@ fun ProductDetailPage(navController: NavController) {
) {
Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit")
}
IconButton(
onClick = {
drawerState = DrawerValue.Open
}
) {
Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu")
}

}
)
},

) { innerPadding ->
val modifier = Modifier.padding(innerPadding)
Column(
Expand Down