@@ -2,8 +2,6 @@ package com.javernaut.whatthecodec.home.ui.stream
2
2
3
3
import androidx.compose.animation.AnimatedVisibility
4
4
import androidx.compose.animation.core.animateFloatAsState
5
- import androidx.compose.foundation.clickable
6
- import androidx.compose.foundation.interaction.MutableInteractionSource
7
5
import androidx.compose.foundation.layout.Arrangement.spacedBy
8
6
import androidx.compose.foundation.layout.Column
9
7
import androidx.compose.foundation.layout.PaddingValues
@@ -17,10 +15,10 @@ import androidx.compose.foundation.lazy.LazyColumn
17
15
import androidx.compose.foundation.lazy.itemsIndexed
18
16
import androidx.compose.material.icons.Icons
19
17
import androidx.compose.material.icons.filled.ExpandLess
20
- import androidx.compose.material.ripple.rememberRipple
21
18
import androidx.compose.material3.Card
22
19
import androidx.compose.material3.CardDefaults
23
20
import androidx.compose.material3.Icon
21
+ import androidx.compose.material3.IconButton
24
22
import androidx.compose.material3.MaterialTheme
25
23
import androidx.compose.material3.Text
26
24
import androidx.compose.runtime.Composable
@@ -35,10 +33,12 @@ import androidx.compose.ui.platform.LocalLayoutDirection
35
33
import androidx.compose.ui.res.stringResource
36
34
import androidx.compose.ui.text.style.TextAlign
37
35
import androidx.compose.ui.text.style.TextOverflow
36
+ import androidx.compose.ui.tooling.preview.PreviewLightDark
38
37
import androidx.compose.ui.unit.LayoutDirection
39
38
import androidx.compose.ui.unit.dp
40
39
import com.javernaut.whatthecodec.R
41
40
import com.javernaut.whatthecodec.compose.common.GridLayout
41
+ import com.javernaut.whatthecodec.compose.theme.WhatTheCodecTheme
42
42
import io.github.javernaut.mediafile.BasicStreamInfo
43
43
import io.github.javernaut.mediafile.MediaStream
44
44
@@ -136,10 +136,9 @@ private fun StreamCardTopRow(
136
136
arrowClicked : () -> Unit
137
137
) {
138
138
Row (
139
- Modifier
139
+ verticalAlignment = Alignment .CenterVertically ,
140
+ modifier = Modifier
140
141
.height(56 .dp)
141
- .padding(end = 5 .dp),
142
- verticalAlignment = Alignment .CenterVertically
143
142
) {
144
143
Text (
145
144
text = title,
@@ -151,23 +150,32 @@ private fun StreamCardTopRow(
151
150
maxLines = 1
152
151
)
153
152
154
- val angle by animateFloatAsState(
155
- targetValue = if (gridVisible)
156
- if (LocalLayoutDirection .current == LayoutDirection .Ltr ) 360f else 0f
157
- else 180f
158
- )
159
- Icon (
160
- Icons .Filled .ExpandLess ,
161
- contentDescription = null ,
162
- modifier = Modifier
163
- .rotate(angle)
164
- .clickable(
165
- interactionSource = remember { MutableInteractionSource () },
166
- indication = rememberRipple(bounded = false ),
167
- onClick = arrowClicked
168
- )
169
- .padding(12 .dp),
170
- )
153
+ IconButton (
154
+ onClick = arrowClicked,
155
+ modifier = Modifier .padding(end = 4 .dp)
156
+ ) {
157
+ val angle by animateFloatAsState(
158
+ targetValue = if (gridVisible)
159
+ if (LocalLayoutDirection .current == LayoutDirection .Ltr ) 360f else 0f
160
+ else 180f
161
+ )
162
+ Icon (
163
+ imageVector = Icons .Filled .ExpandLess ,
164
+ contentDescription = null ,
165
+ modifier = Modifier .rotate(angle)
166
+ )
167
+ }
168
+ }
169
+ }
170
+
171
+
172
+ @PreviewLightDark
173
+ @Composable
174
+ private fun StreamCardTopRowPreview () {
175
+ WhatTheCodecTheme .Static {
176
+ StreamCard (
177
+ title = " Title"
178
+ ) {}
171
179
}
172
180
}
173
181
0 commit comments