Skip to content

Commit 5bbb021

Browse files
authored
Remove redundant hardcoded sizes on Compose design icons (#6478)
* refactor(compose): drop redundant 20dp hardcoded sizes on design icons Removes Modifier.size(20.dp) from Icon call sites that paint a 20dp intrinsic stream_design_ic_* drawable. The size is redundant because Icon falls back to the painter's intrinsic size when no size modifier is applied, and removing it lets integrators override the drawable file to drive the rendered size. Touched: ComposerCancelIcon, AudioRecordAttachmentContent PlaybackToggleButton, UnsupportedAttachmentContent, VideoPlaybackControls play/pause toggle, AddMembersScreen back arrow. * refactor(compose): drop redundant 20dp sizes on poll icons Removes Modifier.size(20.dp) from poll-feature icons painted with 20dp intrinsic drawables: PollAnswers add-answer button, PollOptionList remove and error icons, PollSwitchList StepperButton minus/plus icons. * refactor(compose): drop redundant 20dp sizes in media gallery preview Removes Modifier.size(20.dp) from the share/cancel-share and photos icons in MediaGalleryPreviewScreen, and from the option-row icon in MediaGalleryPreviewOptionsMenu. Every painter consumed by these call sites is a 20dp intrinsic stream_design_ic_* drawable, so the size modifier was redundant. * refactor(compose): drop redundant 20dp sizes in ContextualMenuItem Removes Modifier.size(20.dp) from both leadingIcon and trailingIcon Icons in ContextualMenuItem. Every caller (message action options, the in-file MenuItem preview) passes a 20dp intrinsic stream_design_ic_* drawable, so the hardcoded size was redundant and blocked integrator drawable overrides from propagating. * refactor(compose): drop redundant 20dp size on MessageFailedIcon The MessageFailedIcon factory paints a 20dp intrinsic stream_design_ic_exclamation_circle_fill, so the .size(20.dp) injected into MessageFailedIconParams.modifier by callers was redundant. Removes it from the two MessageContainer call sites and the PollMessageContent call site.
1 parent bcc03be commit 5bbb021

13 files changed

Lines changed: 0 additions & 25 deletions

File tree

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/AudioRecordAttachmentContent.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ internal fun PlaybackToggleButton(
300300
) {
301301
Icon(
302302
painter = icon,
303-
modifier = Modifier.size(20.dp),
304303
contentDescription = label,
305304
)
306305
}

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/UnsupportedAttachmentContent.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.Column
2121
import androidx.compose.foundation.layout.Row
2222
import androidx.compose.foundation.layout.fillMaxWidth
2323
import androidx.compose.foundation.layout.padding
24-
import androidx.compose.foundation.layout.size
2524
import androidx.compose.foundation.shape.RoundedCornerShape
2625
import androidx.compose.material3.Icon
2726
import androidx.compose.material3.Text
@@ -32,7 +31,6 @@ import androidx.compose.ui.res.painterResource
3231
import androidx.compose.ui.res.stringResource
3332
import androidx.compose.ui.text.style.TextOverflow
3433
import androidx.compose.ui.tooling.preview.Preview
35-
import androidx.compose.ui.unit.dp
3634
import io.getstream.chat.android.compose.R
3735
import io.getstream.chat.android.compose.state.messages.attachments.AttachmentState
3836
import io.getstream.chat.android.compose.ui.theme.ChatTheme
@@ -80,7 +78,6 @@ public fun UnsupportedAttachmentContent(
8078
painter = painterResource(R.drawable.stream_design_ic_unsupported_attachment),
8179
tint = ChatTheme.colors.textPrimary,
8280
contentDescription = null,
83-
modifier = Modifier.size(20.dp),
8481
)
8582

8683
Text(

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/preview/MediaGalleryPreviewOptionsMenu.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.Row
2222
import androidx.compose.foundation.layout.Spacer
2323
import androidx.compose.foundation.layout.fillMaxWidth
2424
import androidx.compose.foundation.layout.padding
25-
import androidx.compose.foundation.layout.size
2625
import androidx.compose.foundation.layout.width
2726
import androidx.compose.material3.ExperimentalMaterial3Api
2827
import androidx.compose.material3.Icon
@@ -37,7 +36,6 @@ import androidx.compose.ui.Modifier
3736
import androidx.compose.ui.res.painterResource
3837
import androidx.compose.ui.res.stringResource
3938
import androidx.compose.ui.text.style.TextOverflow
40-
import androidx.compose.ui.unit.dp
4139
import io.getstream.chat.android.compose.R
4240
import io.getstream.chat.android.compose.state.mediagallerypreview.Delete
4341
import io.getstream.chat.android.compose.state.mediagallerypreview.MediaGalleryPreviewOption
@@ -132,7 +130,6 @@ internal fun MediaGalleryOptionItem(
132130
verticalAlignment = Alignment.CenterVertically,
133131
) {
134132
Icon(
135-
modifier = Modifier.size(20.dp),
136133
painter = option.iconPainter,
137134
tint = option.iconColor,
138135
contentDescription = option.title,

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/preview/MediaGalleryPreviewScreen.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ internal fun MediaGalleryPreviewShareIcon(
873873
Icon(
874874
painter = painterResource(id = painter),
875875
contentDescription = stringResource(id = description),
876-
modifier = Modifier.size(20.dp),
877876
)
878877
}
879878
}
@@ -949,7 +948,6 @@ internal fun MediaGalleryPreviewPhotosIcon(
949948
Icon(
950949
painter = painterResource(id = R.drawable.stream_design_ic_gallery),
951950
contentDescription = stringResource(id = R.string.stream_compose_image_preview_photos),
952-
modifier = Modifier.size(20.dp),
953951
)
954952
}
955953
}

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/preview/internal/VideoPlaybackControls.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ internal fun VideoPlaybackControls(
114114
Icon(
115115
painter = painterResource(icon),
116116
contentDescription = stringResource(contentDescription),
117-
modifier = Modifier.size(20.dp),
118117
)
119118
}
120119

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/info/AddMembersScreen.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ private fun AddMembersHeader(
179179
style = StreamButtonStyleDefaults.secondaryGhost,
180180
) {
181181
Icon(
182-
modifier = Modifier.size(20.dp),
183182
painter = painterResource(id = R.drawable.stream_design_ic_arrow_left),
184183
contentDescription = stringResource(id = UiCommonR.string.stream_ui_back_button),
185184
)

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/ComposerCancelIcon.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package io.getstream.chat.android.compose.ui.components
1919
import androidx.compose.foundation.background
2020
import androidx.compose.foundation.border
2121
import androidx.compose.foundation.layout.padding
22-
import androidx.compose.foundation.layout.size
2322
import androidx.compose.foundation.shape.CircleShape
2423
import androidx.compose.material3.Icon
2524
import androidx.compose.runtime.Composable
@@ -52,7 +51,6 @@ public fun ComposerCancelIcon(
5251
.border(2.dp, colors.controlRemoveBorder, CircleShape)
5352
.padding(2.dp)
5453
.background(color = colors.controlRemoveBg, shape = CircleShape)
55-
.size(20.dp)
5654
.clickable(bounded = false, onClick = onClick),
5755
painter = painterResource(R.drawable.stream_design_ic_xmark_small),
5856
contentDescription = contentDescription,

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/common/ContextualMenu.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.Row
2525
import androidx.compose.foundation.layout.defaultMinSize
2626
import androidx.compose.foundation.layout.fillMaxWidth
2727
import androidx.compose.foundation.layout.padding
28-
import androidx.compose.foundation.layout.size
2928
import androidx.compose.foundation.layout.width
3029
import androidx.compose.foundation.shape.RoundedCornerShape
3130
import androidx.compose.material3.HorizontalDivider
@@ -96,7 +95,6 @@ internal fun ContextualMenuItem(
9695
painter = it,
9796
contentDescription = null,
9897
tint = iconColor,
99-
modifier = Modifier.size(20.dp),
10098
)
10199
}
102100

@@ -114,7 +112,6 @@ internal fun ContextualMenuItem(
114112
painter = it,
115113
contentDescription = null,
116114
tint = iconColor,
117-
modifier = Modifier.size(20.dp),
118115
)
119116
}
120117
}

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ public fun PollMessageContent(
160160
params = MessageFailedIconParams(
161161
modifier = Modifier
162162
.padding(vertical = StreamTokens.spacingXs)
163-
.size(20.dp)
164163
.align(Alignment.TopEnd),
165164
message = message,
166165
),

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollAnswers.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import androidx.compose.ui.res.painterResource
5858
import androidx.compose.ui.res.stringResource
5959
import androidx.compose.ui.semantics.semantics
6060
import androidx.compose.ui.tooling.preview.Preview
61-
import androidx.compose.ui.unit.dp
6261
import androidx.compose.ui.window.Popup
6362
import io.getstream.chat.android.compose.R
6463
import io.getstream.chat.android.compose.ui.components.avatar.AvatarSize
@@ -156,7 +155,6 @@ private fun Content(
156155
Icon(
157156
painter = painterResource(id = R.drawable.stream_design_ic_edit),
158157
contentDescription = stringResource(id = R.string.stream_compose_add_answer),
159-
modifier = Modifier.size(20.dp),
160158
)
161159
}
162160
}

0 commit comments

Comments
 (0)