1
1
package app.passwordstore.ui
2
2
3
+ import android.annotation.SuppressLint
4
+ import androidx.compose.foundation.layout.RowScope
3
5
import androidx.compose.material.icons.Icons
4
6
import androidx.compose.material.icons.automirrored.filled.ArrowBack
7
+ import androidx.compose.material.icons.filled.Search
5
8
import androidx.compose.material3.ExperimentalMaterial3Api
6
9
import androidx.compose.material3.Icon
7
10
import androidx.compose.material3.IconButton
@@ -20,6 +23,7 @@ import app.passwordstore.ui.compose.preview.DevicePreviews
20
23
import app.passwordstore.ui.compose.preview.ThemePreviews
21
24
import app.passwordstore.ui.compose.theme.APSTheme
22
25
26
+ @SuppressLint(" ComposableLambdaParameterNaming" ) // The lint doesn't really apply to `actions`
23
27
@Composable
24
28
@OptIn(ExperimentalMaterial3Api ::class )
25
29
public fun APSAppBar (
@@ -28,6 +32,7 @@ public fun APSAppBar(
28
32
navigationIcon : Painter ? ,
29
33
modifier : Modifier = Modifier ,
30
34
onNavigationIconClick : (() -> Unit ) = {},
35
+ actions : @Composable RowScope .() -> Unit = {},
31
36
) {
32
37
TopAppBar (
33
38
title = { Text (text = title) },
@@ -41,6 +46,7 @@ public fun APSAppBar(
41
46
}
42
47
}
43
48
},
49
+ actions = actions,
44
50
colors = TopAppBarDefaults .topAppBarColors(containerColor = backgroundColor),
45
51
modifier = modifier.shadow(8 .dp),
46
52
)
@@ -55,6 +61,14 @@ private fun APSAppBarPreview() {
55
61
title = " Preview" ,
56
62
backgroundColor = MaterialTheme .colorScheme.surface,
57
63
navigationIcon = rememberVectorPainter(Icons .AutoMirrored .Filled .ArrowBack ),
64
+ actions = {
65
+ IconButton (onClick = {}) {
66
+ Icon (
67
+ painter = rememberVectorPainter(Icons .Filled .Search ),
68
+ contentDescription = " Search items" ,
69
+ )
70
+ }
71
+ }
58
72
)
59
73
}
60
74
}
0 commit comments