commit
5e9b8adc8b
@ -1,4 +1,161 @@
|
|||||||
package com.example.what_the_fantasy.ui.components
|
package com.example.what_the_fantasy.ui.components
|
||||||
|
|
||||||
class NavBar {
|
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.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.size
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.rounded.*
|
||||||
|
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.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
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
|
||||||
|
fun NavBar(onProfile : Boolean = false ,
|
||||||
|
onFavorite : Boolean = false ,
|
||||||
|
onAccueil : Boolean = false ,
|
||||||
|
onQuiz : Boolean = false ,
|
||||||
|
index:Int,
|
||||||
|
navControllerProfil: (Int) -> Unit,
|
||||||
|
navControllerFavorite:(Int) -> Unit,
|
||||||
|
navControllerAccueil: (Int) -> Unit,
|
||||||
|
navControllerQuiz: (Int) -> Unit,
|
||||||
|
|
||||||
|
|
||||||
|
content : @Composable ()-> Unit ) {
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(70.dp)
|
||||||
|
.background(colorNavBar),
|
||||||
|
Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.Bottom
|
||||||
|
) {
|
||||||
|
ButtonIconVectorInt(Icons.Rounded.AccountCircle,"Profile",navControllerProfil,index,onProfile)
|
||||||
|
|
||||||
|
|
||||||
|
Button(onClick = {},
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent)
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.toggle),
|
||||||
|
contentDescription = "Theme"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(modifier = Modifier.background(Color.Black).fillMaxHeight(0.92f)){
|
||||||
|
content()
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(modifier = Modifier
|
||||||
|
.background(colorNavBar)
|
||||||
|
.fillMaxSize(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceAround,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
|
||||||
|
ButtonIconVectorInt(Icons.Rounded.Favorite,"Favorite",navControllerFavorite,index,onFavorite)
|
||||||
|
|
||||||
|
ButtonIconPainterInt(painterResource(R.mipmap.ic_launcher_foreground),"Accueil",navControllerAccueil,index,onAccueil)
|
||||||
|
|
||||||
|
ButtonIconVectorInt(Icons.Rounded.Create,"Quiz",navControllerQuiz,index,onQuiz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Composable
|
||||||
|
fun ButtonIconVector(img : ImageVector, name : String, nav : ()->Unit ,onPage : Boolean){
|
||||||
|
IconButton(onClick = {nav()},
|
||||||
|
enabled = !onPage,
|
||||||
|
colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné
|
||||||
|
Color.Transparent, colorButtonNav),//couleur quand il est selectionné
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
) {
|
||||||
|
Icon(img,
|
||||||
|
contentDescription = name,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Composable
|
||||||
|
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é
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
) {
|
||||||
|
Icon(img,
|
||||||
|
contentDescription = name,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ButtonIconPainter(img : Painter, name : String, nav : ()->Unit,onPage : Boolean){
|
||||||
|
IconButton(onClick = {nav()},
|
||||||
|
enabled = !onPage,
|
||||||
|
colors = IconButtonColors(Color.Transparent,Color.White,//couleur quand il n'est pas selectionné
|
||||||
|
Color.Transparent, colorButtonNav),//couleur quand il est selectionné
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
) {
|
||||||
|
Icon(img,
|
||||||
|
contentDescription = name,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Composable
|
||||||
|
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é
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
) {
|
||||||
|
Icon(img,
|
||||||
|
contentDescription = name,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(60.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.example.what_the_fantasy.ui.components
|
||||||
|
|
||||||
|
import java.security.MessageDigest
|
||||||
|
|
||||||
|
fun hashPassword(password: String): String {
|
||||||
|
// SHA-256
|
||||||
|
val digest = MessageDigest.getInstance("SHA-256")
|
||||||
|
|
||||||
|
// Convertir mdp en bytes et appliquer le hash
|
||||||
|
val hashedBytes = digest.digest(password.toByteArray())
|
||||||
|
|
||||||
|
// Convertir le tableau de bytes en une chaîne hexadécimale
|
||||||
|
return hashedBytes.joinToString("") { "%02x".format(it) }
|
||||||
|
}
|
@ -1,6 +1,42 @@
|
|||||||
package com.example.what_the_fantasy.ui.screens
|
package com.example.what_the_fantasy.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.example.what_the_fantasy.data.services.IServices
|
||||||
|
import com.example.what_the_fantasy.ui.components.NavBar
|
||||||
|
import com.example.what_the_fantasy.ui.theme.colorBackground
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AccueilPage() {}
|
fun AccueilPage(
|
||||||
|
index: Int,
|
||||||
|
navFavorite:(Int) -> Unit,
|
||||||
|
navQuiz: (Int) -> Unit,
|
||||||
|
navProfil:(Int) -> Unit
|
||||||
|
) {
|
||||||
|
NavBar(onAccueil = true,
|
||||||
|
index = index,
|
||||||
|
navControllerFavorite = navFavorite,
|
||||||
|
navControllerAccueil = { },
|
||||||
|
navControllerProfil = navProfil,
|
||||||
|
navControllerQuiz = navQuiz
|
||||||
|
){
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(colorBackground),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
){
|
||||||
|
Column {
|
||||||
|
Text("Accueil", color = Color.White, fontSize = 20.sp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,42 @@
|
|||||||
package com.example.what_the_fantasy.ui.screens
|
package com.example.what_the_fantasy.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.example.what_the_fantasy.data.services.IServices
|
||||||
|
import com.example.what_the_fantasy.ui.components.NavBar
|
||||||
|
import com.example.what_the_fantasy.ui.theme.colorBackground
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FavoritePage() {}
|
fun FavoritePage(
|
||||||
|
index: Int,
|
||||||
|
navAccueil: (Int) -> Unit,
|
||||||
|
navQuiz: (Int) -> Unit,
|
||||||
|
navProfil:(Int) -> Unit
|
||||||
|
) {
|
||||||
|
NavBar(onFavorite = true,
|
||||||
|
index = index,
|
||||||
|
navControllerFavorite = { },
|
||||||
|
navControllerAccueil = navAccueil,
|
||||||
|
navControllerProfil = navProfil,
|
||||||
|
navControllerQuiz = navQuiz
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(colorBackground),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
){
|
||||||
|
Column {
|
||||||
|
Text("Favorite", color = Color.White, fontSize = 20.sp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.example.what_the_fantasy.ui.screens
|
package com.example.what_the_fantasy.ui.screens
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import com.example.what_the_fantasy.ui.components.NavBar
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun QuotePage() {}
|
fun QuotePage() {
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.example.what_the_fantasy.ui.screens
|
package com.example.what_the_fantasy.ui.screens
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import com.example.what_the_fantasy.ui.components.NavBar
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchPage() {}
|
fun SearchPage() {
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.example.what_the_fantasy.ui.screens
|
package com.example.what_the_fantasy.ui.screens
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import com.example.what_the_fantasy.ui.components.NavBar
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SubmitQuotePage() {}
|
fun SubmitQuotePage() {
|
||||||
|
}
|
Loading…
Reference in new issue