Replace Spacers with the horizontalArrangement parameter

This commit is contained in:
Isira Seneviratne 2024-06-23 09:16:27 +05:30
parent b9dd7078ad
commit b092fe2c76
2 changed files with 4 additions and 11 deletions

View File

@ -6,11 +6,9 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -76,7 +74,8 @@ fun Comment(comment: CommentsInfoItem) {
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clickable { isExpanded = !isExpanded } .clickable { isExpanded = !isExpanded }
.padding(all = 8.dp) .padding(all = 8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) { ) {
if (ImageStrategy.shouldLoadImages()) { if (ImageStrategy.shouldLoadImages()) {
AsyncImage( AsyncImage(
@ -95,8 +94,6 @@ fun Comment(comment: CommentsInfoItem) {
) )
} }
Spacer(modifier = Modifier.width(8.dp))
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) { Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) {
if (comment.isPinned) { if (comment.isPinned) {

View File

@ -6,11 +6,9 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
@ -42,6 +40,7 @@ fun CommentRepliesHeader(comment: CommentsInfoItem) {
Column(modifier = Modifier.padding(all = 8.dp)) { Column(modifier = Modifier.padding(all = 8.dp)) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Row( Row(
@ -53,6 +52,7 @@ fun CommentRepliesHeader(comment: CommentsInfoItem) {
comment comment
) )
}, },
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
if (ImageStrategy.shouldLoadImages()) { if (ImageStrategy.shouldLoadImages()) {
@ -67,8 +67,6 @@ fun CommentRepliesHeader(comment: CommentsInfoItem) {
) )
} }
Spacer(modifier = Modifier.width(8.dp))
Column { Column {
Text(text = comment.uploaderName) Text(text = comment.uploaderName)
@ -82,8 +80,6 @@ fun CommentRepliesHeader(comment: CommentsInfoItem) {
} }
} }
Spacer(modifier = Modifier.weight(1f))
Row( Row(
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically