Ajout de l'url de l'image (AsyncImage)

pull/12/head
Leni BEAULATON 2 months ago
parent d102a7f3d8
commit 50aa963de2

@ -68,4 +68,6 @@ dependencies {
androidTestImplementation(libs.androidx.ui.test.junit4) androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest) debugImplementation(libs.androidx.ui.test.manifest)
implementation(libs.coil.compose)
} }

@ -56,6 +56,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.navigation.NavController import androidx.navigation.NavController
import coil.compose.AsyncImage
import com.example.what_the_fantasy.R 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
@ -69,7 +70,7 @@ fun ProfilPage() {
end = Offset(1000f, 0f) // Fin en haut à droite end = Offset(1000f, 0f) // Fin en haut à droite
) )
val user = UserStub.allUsers val user = UserStub.allUsers
val index = 5 // Pour changer l'utilisateur pour le moment val index = 2 // Pour changer l'utilisateur pour le moment
Box( Box(
modifier = Modifier modifier = Modifier
@ -139,15 +140,14 @@ fun TitleProfil(titleResId : Int, size : Int, color : Color){
@Composable @Composable
fun ImageProfil(imgProfil : String, size :Int, sizeBorber : Int, colorBorder : Color){ fun ImageProfil(imgProfil : String, size :Int, sizeBorber : Int, colorBorder : Color){
AsyncImage(
Image( model = imgProfil,
painter = painterResource(imgProfil),
contentDescription = "Photo de profil", contentDescription = "Photo de profil",
modifier = Modifier modifier = Modifier
.size(size.dp) .size(size.dp)
.clip(CircleShape) .clip(CircleShape)
.border(sizeBorber.dp, colorBorder, CircleShape)
) )
} }

@ -1,5 +1,6 @@
[versions] [versions]
agp = "8.6.0" agp = "8.6.0"
coilCompose = "2.2.1"
kotlin = "1.9.0" kotlin = "1.9.0"
coreKtx = "1.10.1" coreKtx = "1.10.1"
junit = "4.13.2" junit = "4.13.2"
@ -13,6 +14,7 @@ navigationCommonAndroid = "2.9.0-alpha05"
[libraries] [libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilCompose" }
junit = { group = "junit", name = "junit", version.ref = "junit" } junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }

Loading…
Cancel
Save