NavBar inférieur et supérieur faite style bouton a corigé & mettre la nav dans les onclick

pull/24/head
brongniart 2 months ago
parent c0301aa604
commit 0224bbf149

@ -4,29 +4,92 @@ import android.widget.ImageView
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row 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.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.BottomAppBar import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.Button
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.TextUnit
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.R
import com.example.what_the_fantasy.ui.navigations.AppNavigator
import com.example.what_the_fantasy.ui.theme.colorNavBar import com.example.what_the_fantasy.ui.theme.colorNavBar
@Composable @Composable
fun NavBar(actualPage :String) { fun NavBar(content : @Composable ()-> Unit ) {
FlowRow(modifier = Modifier val nav = AppNavigator()
.background(colorNavBar),
Arrangement.SpaceAround Column(
modifier = Modifier
.fillMaxSize()
) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(55.dp)
.background(colorNavBar)
.padding(10.dp),
Arrangement.SpaceBetween,
verticalAlignment = Alignment.Bottom
) {
Button(onClick = {}, Modifier.background(Color.Unspecified)) {
Text("Profile", fontSize = 25.sp, color = Color.White)
}
Button(onClick = {}) {
Text("Theme", fontSize = 25.sp, color = Color.White)
}
}
Box(modifier = Modifier.background(Color.Black).fillMaxHeight(0.92f)){
content()
}
Row(modifier = Modifier
.background(colorNavBar)
.fillMaxSize(),
horizontalArrangement = Arrangement.SpaceAround,
verticalAlignment = Alignment.CenterVertically
) { ) {
Text("Favorie")
Image( painter = painterResource(R.mipmap.ic_launcher_foreground), contentDescription = "Accueil")
Text("Quiz")
Button(onClick = {}) {
Text("Favorie", fontSize = 25.sp, color = Color.White)
}
Button(onClick = {}) {
Image(
painter = painterResource(R.mipmap.ic_launcher_foreground),
contentDescription = "Accueil",
modifier = Modifier
.size(100.dp)
)
}
Button(onClick = {}) {
Text("Quiz", fontSize = 25.sp, color = Color.White)
} }
} }
}
}

@ -1,6 +1,11 @@
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 AccueilPage() {} fun AccueilPage() {
NavBar {
}
}

@ -1,6 +1,11 @@
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 FavoritePage() {} fun FavoritePage() {
NavBar {
}
}

@ -50,7 +50,6 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: () -> Unit)
val users = UserStub.allUsers; val users = UserStub.allUsers;
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
@ -76,8 +75,9 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: () -> Unit)
SpaceHeightComponent(16) SpaceHeightComponent(16)
CreateAccountButton(R.string.ButtonCreateLogin,12, Color.White, navControllerSignUp) CreateAccountButton(R.string.ButtonCreateLogin,12, Color.White, navControllerSignUp)
} }
NavBar("")
} }
} }

@ -62,6 +62,7 @@ import com.example.what_the_fantasy.R
import com.example.what_the_fantasy.data.local.QuestionStub import com.example.what_the_fantasy.data.local.QuestionStub
import com.example.what_the_fantasy.data.local.UserStub import com.example.what_the_fantasy.data.local.UserStub
import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent
import com.example.what_the_fantasy.ui.components.NavBar
import com.example.what_the_fantasy.ui.components.SpaceHeightComponent import com.example.what_the_fantasy.ui.components.SpaceHeightComponent
import com.example.what_the_fantasy.ui.components.TitlePageComponent import com.example.what_the_fantasy.ui.components.TitlePageComponent
import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme
@ -75,7 +76,7 @@ fun ProfilPage(navController: NavController) {
) )
val user = UserStub.allUsers val user = UserStub.allUsers
val index = 2 // Pour changer l'utilisateur pour le moment val index = 2 // Pour changer l'utilisateur pour le moment
NavBar {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
@ -119,6 +120,7 @@ fun ProfilPage(navController: NavController) {
} }
} }
} }
}

@ -27,6 +27,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.example.what_the_fantasy.data.local.QuestionStub import com.example.what_the_fantasy.data.local.QuestionStub
import com.example.what_the_fantasy.data.model.Question import com.example.what_the_fantasy.data.model.Question
import com.example.what_the_fantasy.ui.components.NavBar
@Composable @Composable
fun QuizPage() { fun QuizPage() {
@ -37,7 +38,7 @@ fun QuizPage() {
) )
val questions = QuestionStub.allQuestions val questions = QuestionStub.allQuestions
NavBar {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
@ -103,5 +104,6 @@ fun QuizPage() {
} }
} }
} }
}

@ -1,6 +1,11 @@
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() {
NavBar {
}
}

@ -1,6 +1,11 @@
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() {
NavBar {
}
}

@ -1,6 +1,11 @@
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() {
NavBar {
}
}
Loading…
Cancel
Save