Skip to content

Commit

Permalink
Fix image size inconsistency in lesson and theme cards
Browse files Browse the repository at this point in the history
  • Loading branch information
daniyelp authored and daniyelp committed Jan 18, 2022
1 parent f5bf7b9 commit 264bcdd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion commons/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ android {

dependencies {
implementation(project(BuildModules.CORE))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ fun LessonCard(
modifier = Modifier.fillMaxSize()
) {
Image(
modifier = Modifier.fillMaxHeight(),
contentScale = ContentScale.FillHeight,
painter = rememberImagePainter(lesson.thumbnail.url),
modifier = Modifier
.aspectRatio(1f)
.fillMaxHeight(),
contentScale = ContentScale.Crop,
painter = rememberImagePainter(lesson.thumbnail.url) {
error(R.drawable.art1)
},
contentDescription = lesson.title
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ package com.teacherworkout.commons.ui.composables
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.MaterialTheme
Expand Down Expand Up @@ -39,9 +36,13 @@ fun LessonThemeCard(
modifier = Modifier.fillMaxSize()
){
Image(
modifier = Modifier.fillMaxHeight(),
contentScale = ContentScale.FillHeight,
painter = rememberImagePainter(lessonTheme.thumbnail.url),
modifier = Modifier
.aspectRatio(1f)
.fillMaxHeight(),
contentScale = ContentScale.Crop,
painter = rememberImagePainter(lessonTheme.thumbnail.url) {
error(R.drawable.art1)
},
contentDescription = lessonTheme.thumbnail.description
)
Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ sealed class ErrorEntity(val message: String?) {
object ServerError: ApiError("Server error")
object NotFound: ApiError("Not found")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ class ApolloLessonsRepository(private val apolloClient: ApolloClient): LessonsRe
executeQuery(LessonEntityQuery(id)) {
it.lessonStatuses!!.single().lesson
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ val networkModule = module {
single<LessonsRepository>{
ApolloLessonsRepository(get())
}
}
}

0 comments on commit 264bcdd

Please sign in to comment.