diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt
index 035646d..8d89f41 100644
--- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt
+++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt
@@ -1,39 +1,37 @@
package com.example.what_the_fantasy.ui.components
-import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
-
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
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.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.*
import androidx.compose.material3.BottomAppBar
-import androidx.compose.material3.Button
-import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonColors
-import androidx.compose.material3.Text
-import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.IconToggleButton
+import androidx.compose.material3.NavigationBar
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
-import androidx.compose.ui.unit.sp
import com.example.what_the_fantasy.R
-import com.example.what_the_fantasy.data.services.IServices
import com.example.what_the_fantasy.ui.theme.*
@Composable
@@ -49,49 +47,69 @@ fun NavBar(onProfile : Boolean = false ,
content : @Composable ()-> Unit ) {
+ var theme by remember { mutableStateOf(true) }
Column(
modifier = Modifier
.fillMaxSize()
) {
- Row(
+ NavigationBar(
modifier = Modifier
- .fillMaxWidth()
- .height(70.dp)
- .padding(5.dp)
- .background(colorNavBar),
- Arrangement.SpaceBetween,
- verticalAlignment = Alignment.Bottom
+ .fillMaxWidth(),
+ containerColor = colorNavBar
) {
- ButtonIconVectorInt(Icons.Rounded.AccountCircle,"Profile",navControllerProfil,index,onProfile)
-
-
- Button(onClick = {},
- colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent)
+ Row(
+ modifier = Modifier
+ .fillMaxWidth(),
+ Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.Bottom
) {
- Image(
- painter = painterResource(id = R.drawable.toggle),
- contentDescription = "Theme"
- )
- }
+ ButtonIconVectorInt(Icons.Rounded.AccountCircle,"Profile",navControllerProfil,index,onProfile)
+
+
+ IconButton(onClick = { theme=!theme},
+ modifier = Modifier.size(60.dp)
+ .clip(RoundedCornerShape(0))
+ ) {
+ Icon(painterResource(
+ if(theme)R.drawable.dark_mode_toggle_icon
+ else R.drawable.light_mode_toggle_icon),
+ contentDescription = "Dark mode",
+ modifier = Modifier.fillMaxSize(),
+ tint = Color.White
+ )
+ }
+ }
}
- Box(modifier = Modifier.background(Color.Black).fillMaxHeight(0.92f)){
+ Box(modifier = Modifier.background(Color.Black).fillMaxHeight(0.90f)){
content()
}
- BottomAppBar (modifier = Modifier.fillMaxSize(),) {
+
+ BottomAppBar (modifier = Modifier
+ .fillMaxSize(),
+ containerColor = colorNavBar
+ ) {
Row(modifier = Modifier
- .background(colorNavBar)
.fillMaxSize(),
horizontalArrangement = Arrangement.SpaceAround,
verticalAlignment = Alignment.CenterVertically
) {
- ButtonIconVectorInt(Icons.Rounded.Favorite,"Favorite",navControllerFavorite,index,onFavorite)
+ ButtonIconPainterInt(painterResource(
+ if(onFavorite)R.drawable.favorite_button_full
+ else R.drawable.favorite_button_empty
+ ),"Favorite",navControllerFavorite,index,onFavorite)
- ButtonIconPainterInt(painterResource(R.mipmap.ic_launcher_foreground),"Accueil",navControllerAccueil,index,onAccueil)
+ ButtonIconPainterInt(painterResource(
+ if(onAccueil)R.drawable.home_button_full
+ else R.drawable.home_button_empty
+ ),"Accueil",navControllerAccueil,index,onAccueil)
- ButtonIconVectorInt(Icons.Rounded.Create,"Quiz",navControllerQuiz,index,onQuiz)
+ ButtonIconPainterInt(painterResource(
+ if(onQuiz)R.drawable.quiz_button_full
+ else R.drawable.quiz_button_empty
+ ),"Quiz",navControllerQuiz,index,onQuiz)
}
}
@@ -102,15 +120,15 @@ fun NavBar(onProfile : Boolean = false ,
fun ButtonIconVectorInt(img : ImageVector, name : String, nav : (Int)->Unit ,index: Int,onPage : Boolean){
IconButton(onClick = {nav(index)},
enabled = !onPage,
- colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné
- Color.Transparent, colorButtonNav),//couleur quand il est selectionné
+ colors = IconButtonColors(Color.Transparent, colorButtonNav,//couleur quand il n'est pas selectionné
+ Color.Transparent, colorButtonNavSelected),//couleur quand il est selectionné
modifier = Modifier
.size(60.dp)
) {
Icon(img,
contentDescription = name,
modifier = Modifier
- .size(60.dp)
+ .fillMaxSize()
)
}
}
@@ -120,15 +138,15 @@ fun ButtonIconVectorInt(img : ImageVector, name : String, nav : (Int)->Unit ,ind
fun ButtonIconPainterInt(img : Painter, name : String, nav : (Int)->Unit,index: Int,onPage : Boolean){
IconButton(onClick = {nav(index)},
enabled = !onPage,
- colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné
- Color.Transparent, colorButtonNav),//couleur quand il est selectionné
+ colors = IconButtonColors(Color.Transparent,colorButtonNav,//couleur quand il n'est pas selectionné
+ Color.Transparent, colorButtonNavSelected),//couleur quand il est selectionné
modifier = Modifier
.size(60.dp)
) {
Icon(img,
contentDescription = name,
modifier = Modifier
- .size(60.dp)
+ .fillMaxSize()
)
}
}
diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt
index 880122c..0ef8b24 100644
--- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt
+++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/theme/Color.kt
@@ -18,6 +18,7 @@ val gradienBox = Brush.linearGradient(
)
val colorBackground = Color(0xFF100C1B)
-val colorNavBar = Color(0xFF2F0E62)
+val colorNavBar = Color.Black
-val colorButtonNav = Color.Cyan
\ No newline at end of file
+val colorButtonNavSelected= Color(0xFFC8C8C8)
+val colorButtonNav = Color.White
\ No newline at end of file
diff --git a/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml
new file mode 100644
index 0000000..752f388
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/dark_mode_toggle_icon.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/favorite_button_empty.xml b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_empty.xml
new file mode 100644
index 0000000..33a5dda
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_empty.xml
@@ -0,0 +1,12 @@
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/favorite_button_full.xml b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_full.xml
new file mode 100644
index 0000000..3443b39
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/favorite_button_full.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/home_button_empty.xml b/What_The_Fantasy/app/src/main/res/drawable/home_button_empty.xml
new file mode 100644
index 0000000..1eba6f8
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/home_button_empty.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/home_button_full.xml b/What_The_Fantasy/app/src/main/res/drawable/home_button_full.xml
new file mode 100644
index 0000000..c2959b3
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/home_button_full.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml b/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml
new file mode 100644
index 0000000..8e171be
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/light_mode_toggle_icon.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/like_icon.png b/What_The_Fantasy/app/src/main/res/drawable/like_icon.png
deleted file mode 100644
index 6d62a6c..0000000
Binary files a/What_The_Fantasy/app/src/main/res/drawable/like_icon.png and /dev/null differ
diff --git a/What_The_Fantasy/app/src/main/res/drawable/profile_icon.png b/What_The_Fantasy/app/src/main/res/drawable/profile_icon.png
deleted file mode 100644
index 4fe3158..0000000
Binary files a/What_The_Fantasy/app/src/main/res/drawable/profile_icon.png and /dev/null differ
diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz_button_empty.xml b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_empty.xml
new file mode 100644
index 0000000..a1e039a
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_empty.xml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz_button_full.xml b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_full.xml
new file mode 100644
index 0000000..dd8a0a4
--- /dev/null
+++ b/What_The_Fantasy/app/src/main/res/drawable/quiz_button_full.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/What_The_Fantasy/app/src/main/res/drawable/quiz_icon.png b/What_The_Fantasy/app/src/main/res/drawable/quiz_icon.png
deleted file mode 100644
index a4aca0e..0000000
Binary files a/What_The_Fantasy/app/src/main/res/drawable/quiz_icon.png and /dev/null differ
diff --git a/What_The_Fantasy/app/src/main/res/drawable/toggle.png b/What_The_Fantasy/app/src/main/res/drawable/toggle.png
deleted file mode 100644
index a21a368..0000000
Binary files a/What_The_Fantasy/app/src/main/res/drawable/toggle.png and /dev/null differ
diff --git a/What_The_Fantasy/app/src/main/res/drawable/wf_logo.png b/What_The_Fantasy/app/src/main/res/drawable/wf_logo.png
deleted file mode 100644
index 7388be9..0000000
Binary files a/What_The_Fantasy/app/src/main/res/drawable/wf_logo.png and /dev/null differ