diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2024-05-28 15:10:28 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2024-05-28 15:10:28 +0530 |
commit | 09feaf89f64713a3d02fbd3218ecc3f816d6ad7d (patch) | |
tree | eeecdc83c1883c7bee8b7c3f3ce8a3dcb5b8ed47 /ui/compose/src/main/kotlin | |
parent | c33d1100b775aa7396a076580bda11b4159cb30d (diff) |
fix(compose): add `actions` parameter to `APSAppBar`
Diffstat (limited to 'ui/compose/src/main/kotlin')
-rw-r--r-- | ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt index 1a65a2f7..c076686f 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt @@ -1,7 +1,10 @@ package app.passwordstore.ui +import android.annotation.SuppressLint +import androidx.compose.foundation.layout.RowScope import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material.icons.filled.Search import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -20,6 +23,7 @@ import app.passwordstore.ui.compose.preview.DevicePreviews import app.passwordstore.ui.compose.preview.ThemePreviews import app.passwordstore.ui.compose.theme.APSTheme +@SuppressLint("ComposableLambdaParameterNaming") // The lint doesn't really apply to `actions` @Composable @OptIn(ExperimentalMaterial3Api::class) public fun APSAppBar( @@ -28,6 +32,7 @@ public fun APSAppBar( navigationIcon: Painter?, modifier: Modifier = Modifier, onNavigationIconClick: (() -> Unit) = {}, + actions: @Composable RowScope.() -> Unit = {}, ) { TopAppBar( title = { Text(text = title) }, @@ -41,6 +46,7 @@ public fun APSAppBar( } } }, + actions = actions, colors = TopAppBarDefaults.topAppBarColors(containerColor = backgroundColor), modifier = modifier.shadow(8.dp), ) @@ -55,6 +61,14 @@ private fun APSAppBarPreview() { title = "Preview", backgroundColor = MaterialTheme.colorScheme.surface, navigationIcon = rememberVectorPainter(Icons.AutoMirrored.Filled.ArrowBack), + actions = { + IconButton(onClick = {}) { + Icon( + painter = rememberVectorPainter(Icons.Filled.Search), + contentDescription = "Search items", + ) + } + } ) } } |