1616
1717package io.getstream.chat.android.compose.ui.theme
1818
19- import androidx.compose.foundation.BorderStroke
2019import androidx.compose.foundation.isSystemInDarkTheme
21- import androidx.compose.foundation.shape.CircleShape
22- import androidx.compose.foundation.shape.RoundedCornerShape
2320import androidx.compose.runtime.Composable
2421import androidx.compose.runtime.Immutable
2522import androidx.compose.ui.graphics.Color
2623import androidx.compose.ui.graphics.Shape
27- import androidx.compose.ui.graphics.painter.Painter
2824import androidx.compose.ui.res.painterResource
2925import androidx.compose.ui.text.SpanStyle
3026import androidx.compose.ui.text.TextStyle
3127import androidx.compose.ui.text.style.TextDirection
32- import androidx.compose.ui.text.style.TextOverflow
33- import androidx.compose.ui.unit.Dp
3428import androidx.compose.ui.unit.dp
3529import io.getstream.chat.android.compose.R
3630import io.getstream.chat.android.compose.ui.theme.messages.composer.AudioRecordingTheme
@@ -39,16 +33,12 @@ import io.getstream.chat.android.ui.common.feature.messages.composer.mention.Men
3933
4034/* *
4135 * Represents the theming for the message composer.
42- * @param attachmentCancelIcon The theming for the cancel icon used in the message composer.
43- * @param linkPreview The theming for the link preview in the message composer.
4436 * @param inputField The theming for the input field in the message composer.
4537 * @param actionsTheme The theming for the different composer actions.
4638 * @param audioRecording The theming for the audio recording in the message composer.
4739 * @param attachmentsPreview The theming for the attachments preview in the message composer.
4840 */
4941public data class MessageComposerTheme (
50- val attachmentCancelIcon : ComposerCancelIconStyle ,
51- val linkPreview : ComposerLinkPreviewTheme ,
5242 val inputField : ComposerInputFieldTheme ,
5343 val actionsTheme : ComposerActionsTheme ,
5444 val audioRecording : AudioRecordingTheme ,
@@ -73,8 +63,6 @@ public data class MessageComposerTheme(
7363 },
7464 ): MessageComposerTheme {
7565 return MessageComposerTheme (
76- attachmentCancelIcon = ComposerCancelIconStyle .defaultStyle(colors),
77- linkPreview = ComposerLinkPreviewTheme .defaultTheme(typography, shapes, colors),
7866 inputField = ComposerInputFieldTheme .defaultTheme(typography, shapes, colors),
7967 actionsTheme = ComposerActionsTheme .defaultTheme(colors),
8068 audioRecording = AudioRecordingTheme .defaultTheme(isInDarkMode, typography, colors),
@@ -84,119 +72,6 @@ public data class MessageComposerTheme(
8472 }
8573}
8674
87- /* *
88- * Represents the theming for the cancel icon used in the message composer.
89- *
90- * @param backgroundShape The shape of the background for the cancel icon.
91- * @param backgroundColor The background color for the cancel icon.
92- * @param border The border for the cancel icon.
93- * @param painter The painter for the cancel icon.
94- * @param tint The tint color for the cancel icon.
95- */
96- public data class ComposerCancelIconStyle (
97- val backgroundShape : Shape ,
98- val backgroundColor : Color ,
99- val border : BorderStroke ? ,
100- val painter : Painter ,
101- val tint : Color ,
102- ) {
103- public companion object {
104-
105- /* *
106- * Builds the default cancel icon style.
107- *
108- * @return A [ComposerCancelIconStyle] instance holding the default theming.
109- */
110- @Composable
111- public fun defaultStyle (
112- colors : StreamColors = when (isSystemInDarkTheme()) {
113- true -> StreamColors .defaultDarkColors()
114- else -> StreamColors .defaultColors()
115- },
116- ): ComposerCancelIconStyle {
117- return ComposerCancelIconStyle (
118- backgroundShape = CircleShape ,
119- backgroundColor = colors.controlRemoveBg,
120- border = BorderStroke (width = 2 .dp, color = colors.controlRemoveBorder),
121- painter = painterResource(R .drawable.stream_compose_ic_cross),
122- tint = colors.controlRemoveIcon,
123- )
124- }
125- }
126- }
127-
128- /* *
129- * Represents the theming for the link preview in the message composer.
130- *
131- * @param background The background color for the link preview.
132- * @param shape The shape of the link preview.
133- * @param imageSize The size of the image in the link preview.
134- * @param imageShape The shape of the image in the link preview.
135- * @param imageBorder The border for the image in the link preview.
136- * @param imagePadding The padding for the image in the link preview.
137- * @param title The theming for the title in the link preview.
138- * @param titleToSubtitle The vertical space between the title and the subtitle in the link preview.
139- * @param subtitle The theming for the subtitle in the link preview.
140- * @param url The theming for the URL in the link preview.
141- * @param cancelIcon The theming for the cancel icon in the link preview.
142- */
143- public data class ComposerLinkPreviewTheme (
144- val background : Color ,
145- val shape : Shape ,
146- val imageSize : ComponentSize ,
147- val imageShape : Shape ,
148- val imageBorder : BorderStroke ,
149- val imagePadding : Dp ,
150- val title : TextComponentStyle ,
151- val titleToSubtitle : Dp ,
152- val subtitle : TextComponentStyle ,
153- val url : TextComponentStyle ,
154- val cancelIcon : ComposerCancelIconStyle ,
155- ) {
156- public companion object {
157-
158- @Suppress(" DEPRECATION_ERROR" )
159- @Composable
160- public fun defaultTheme (
161- typography : StreamTypography = StreamTypography .defaultTypography(),
162- shapes : StreamShapes = StreamShapes .defaultShapes(),
163- colors : StreamColors = when (isSystemInDarkTheme()) {
164- true -> StreamColors .defaultDarkColors()
165- else -> StreamColors .defaultColors()
166- },
167- ): ComposerLinkPreviewTheme {
168- return ComposerLinkPreviewTheme (
169- background = colors.chatBgOutgoing,
170- shape = shapes.attachment,
171- imageSize = ComponentSize (width = 40 .dp, height = 40 .dp),
172- imageShape = RoundedCornerShape (8 .dp),
173- imageBorder = BorderStroke (1 .dp, colors.borderCoreImage),
174- imagePadding = 4 .dp,
175- title = TextComponentStyle (
176- color = colors.textHighEmphasis,
177- style = typography.footnoteBold,
178- maxLines = 1 ,
179- overflow = TextOverflow .Ellipsis ,
180- ),
181- titleToSubtitle = 0 .dp,
182- subtitle = TextComponentStyle (
183- color = colors.textHighEmphasis,
184- style = typography.footnote,
185- maxLines = 1 ,
186- overflow = TextOverflow .Ellipsis ,
187- ),
188- url = TextComponentStyle (
189- color = colors.textHighEmphasis,
190- style = typography.footnote,
191- maxLines = 1 ,
192- overflow = TextOverflow .Ellipsis ,
193- ),
194- cancelIcon = ComposerCancelIconStyle .defaultStyle(colors),
195- )
196- }
197- }
198- }
199-
20075/* *
20176 * Represents the theming for the input field in the message composer.
20277 *
0 commit comments