11package app.passwordstore.ui
22
3+ import android.annotation.SuppressLint
4+ import androidx.compose.foundation.layout.RowScope
35import androidx.compose.material.icons.Icons
46import androidx.compose.material.icons.automirrored.filled.ArrowBack
7+ import androidx.compose.material.icons.filled.Search
58import androidx.compose.material3.ExperimentalMaterial3Api
69import androidx.compose.material3.Icon
710import androidx.compose.material3.IconButton
@@ -20,6 +23,7 @@ import app.passwordstore.ui.compose.preview.DevicePreviews
2023import app.passwordstore.ui.compose.preview.ThemePreviews
2124import app.passwordstore.ui.compose.theme.APSTheme
2225
26+ @SuppressLint(" ComposableLambdaParameterNaming" ) // The lint doesn't really apply to `actions`
2327@Composable
2428@OptIn(ExperimentalMaterial3Api ::class )
2529public fun APSAppBar (
@@ -28,6 +32,7 @@ public fun APSAppBar(
2832 navigationIcon : Painter ? ,
2933 modifier : Modifier = Modifier ,
3034 onNavigationIconClick : (() -> Unit ) = {},
35+ actions : @Composable RowScope .() -> Unit = {},
3136) {
3237 TopAppBar (
3338 title = { Text (text = title) },
@@ -41,6 +46,7 @@ public fun APSAppBar(
4146 }
4247 }
4348 },
49+ actions = actions,
4450 colors = TopAppBarDefaults .topAppBarColors(containerColor = backgroundColor),
4551 modifier = modifier.shadow(8 .dp),
4652 )
@@ -55,6 +61,14 @@ private fun APSAppBarPreview() {
5561 title = " Preview" ,
5662 backgroundColor = MaterialTheme .colorScheme.surface,
5763 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+ }
5872 )
5973 }
6074}
0 commit comments