1
1
package org.michaelbel.movies.search.ui
2
2
3
3
import androidx.compose.foundation.background
4
+ import androidx.compose.foundation.layout.Arrangement
5
+ import androidx.compose.foundation.layout.Row
4
6
import androidx.compose.foundation.layout.fillMaxWidth
5
7
import androidx.compose.foundation.layout.height
8
+ import androidx.compose.foundation.layout.padding
6
9
import androidx.compose.material3.MaterialTheme
7
10
import androidx.compose.material3.Text
8
11
import androidx.compose.material3.TextButton
9
12
import androidx.compose.runtime.Composable
13
+ import androidx.compose.ui.Alignment
10
14
import androidx.compose.ui.Modifier
11
15
import androidx.compose.ui.res.stringResource
12
16
import androidx.compose.ui.text.style.TextAlign
13
17
import androidx.compose.ui.tooling.preview.Preview
14
18
import androidx.compose.ui.unit.dp
15
- import androidx.constraintlayout.compose.ConstraintLayout
16
- import androidx.constraintlayout.compose.Dimension
17
19
import org.michaelbel.movies.search_impl.R
18
20
import org.michaelbel.movies.ui.theme.MoviesTheme
19
21
@@ -22,7 +24,29 @@ internal fun SearchHistoryHeader(
22
24
onClearButtonClick : () -> Unit ,
23
25
modifier : Modifier = Modifier
24
26
) {
25
- ConstraintLayout (
27
+ Row (
28
+ modifier = modifier
29
+ .fillMaxWidth()
30
+ .padding(start = 16 .dp, end = 8 .dp),
31
+ verticalAlignment = Alignment .CenterVertically ,
32
+ horizontalArrangement = Arrangement .SpaceBetween
33
+ ) {
34
+ Text (
35
+ text = stringResource(R .string.search_recent),
36
+ textAlign = TextAlign .Start ,
37
+ style = MaterialTheme .typography.bodyMedium.copy(MaterialTheme .colorScheme.onPrimaryContainer)
38
+ )
39
+
40
+ TextButton (
41
+ onClick = onClearButtonClick
42
+ ) {
43
+ Text (
44
+ text = stringResource(R .string.search_clear)
45
+ )
46
+ }
47
+ }
48
+
49
+ /* ConstraintLayout(
26
50
modifier = modifier
27
51
) {
28
52
val (recentSearchesText, clearButton) = createRefs()
@@ -54,7 +78,7 @@ internal fun SearchHistoryHeader(
54
78
text = stringResource(R.string.search_clear)
55
79
)
56
80
}
57
- }
81
+ }*/
58
82
}
59
83
60
84
@Preview
0 commit comments