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

pull/24/head
brongniart 2 months ago committed by Kentin BRONGNIART
parent be33806593
commit a36665b102

@ -4,29 +4,92 @@ import android.widget.ImageView
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
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.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.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
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.layout.onGloballyPositioned
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.ui.navigations.AppNavigator
import com.example.what_the_fantasy.ui.theme.colorNavBar
@Composable
fun NavBar(actualPage :String) {
FlowRow(modifier = Modifier
.background(colorNavBar),
Arrangement.SpaceAround
fun NavBar(content : @Composable ()-> Unit ) {
val nav = AppNavigator()
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
import androidx.compose.runtime.Composable
import com.example.what_the_fantasy.ui.components.NavBar
@Composable
fun AccueilPage() {}
fun AccueilPage() {
NavBar {
}
}

@ -1,6 +1,11 @@
package com.example.what_the_fantasy.ui.screens
import androidx.compose.runtime.Composable
import com.example.what_the_fantasy.ui.components.NavBar
@Composable
fun FavoritePage() {}
fun FavoritePage() {
NavBar {
}
}

@ -51,7 +51,6 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: (Int) -> Uni
val users = UserStub.allUsers;
Box(
modifier = Modifier
.fillMaxSize()
@ -77,8 +76,9 @@ fun LoginPage(navControllerSignUp: () -> Unit, navControllerProfil: (Int) -> Uni
SpaceHeightComponent(16)
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.UserStub
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.TitlePageComponent
import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme

@ -20,6 +20,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.example.what_the_fantasy.data.local.QuestionStub
import com.example.what_the_fantasy.data.model.Question
import com.example.what_the_fantasy.ui.components.NavBar
@Composable
fun QuizPage(navController: NavController) {

@ -1,6 +1,11 @@
package com.example.what_the_fantasy.ui.screens
import androidx.compose.runtime.Composable
import com.example.what_the_fantasy.ui.components.NavBar
@Composable
fun QuotePage() {}
fun QuotePage() {
NavBar {
}
}

@ -1,6 +1,11 @@
package com.example.what_the_fantasy.ui.screens
import androidx.compose.runtime.Composable
import com.example.what_the_fantasy.ui.components.NavBar
@Composable
fun SearchPage() {}
fun SearchPage() {
NavBar {
}
}

@ -1,6 +1,11 @@
package com.example.what_the_fantasy.ui.screens
import androidx.compose.runtime.Composable
import com.example.what_the_fantasy.ui.components.NavBar
@Composable
fun SubmitQuotePage() {}
fun SubmitQuotePage() {
NavBar {
}
}
Loading…
Cancel
Save