debut mvvm et commentaire

pull/48/head
kevin.modejar 2 months ago
parent 90384e860d
commit 2f57ac9d82

@ -0,0 +1,9 @@
package com.example.what_the_fantasy.data.mvvm
import androidx.lifecycle.ViewModel
import com.example.what_the_fantasy.data.model.Quiz
import com.example.what_the_fantasy.data.model.Quote
class AppViewModel: ViewModel() {
}

@ -20,6 +20,10 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable 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.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
@ -41,6 +45,8 @@ import com.example.what_the_fantasy.ui.theme.iconText
import com.example.what_the_fantasy.ui.theme.likeIcon import com.example.what_the_fantasy.ui.theme.likeIcon
import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText import com.example.what_the_fantasy.ui.theme.whiteBackcgroundText
var isCommentVisible by mutableStateOf(false)
@Composable @Composable
fun QuotePage( fun QuotePage(
quoteId : Int, quoteId : Int,
@ -51,6 +57,7 @@ fun QuotePage(
navQuiz: (Int) -> Unit, navQuiz: (Int) -> Unit,
navProfil:(Int) -> Unit) navProfil:(Int) -> Unit)
{ {
// utiliser ViewModel
var quote = service.getQuote(quoteId) ?: return var quote = service.getQuote(quoteId) ?: return
val context = LocalContext.current val context = LocalContext.current
NavBar(onProfile = true, NavBar(onProfile = true,
@ -118,6 +125,13 @@ fun QuotePage(
} }
} }
} }
if(isCommentVisible){
Box(modifier = Modifier.fillMaxWidth().background(Color.White)){
Column {
}
}
}
} }
} }
@ -175,7 +189,14 @@ fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){
) )
} }
IconButton( IconButton(
onClick = { }, //Go to comment onClick = {
if(isCommentVisible){
isCommentVisible = false
}
else{
isCommentVisible = true
}
}, //Go to comment
modifier = Modifier.padding(start = 20.dp) modifier = Modifier.padding(start = 20.dp)
){ ){
Icon( Icon(
@ -252,3 +273,5 @@ fun LikeInfo(likes : Int){
tint = iconText, tint = iconText,
) )
} }

Loading…
Cancel
Save