Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 09feaf8

Browse files
committed
fix(compose): add actions parameter to APSAppBar
1 parent c33d110 commit 09feaf8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package app.passwordstore.ui
22

3+
import android.annotation.SuppressLint
4+
import androidx.compose.foundation.layout.RowScope
35
import androidx.compose.material.icons.Icons
46
import androidx.compose.material.icons.automirrored.filled.ArrowBack
7+
import androidx.compose.material.icons.filled.Search
58
import androidx.compose.material3.ExperimentalMaterial3Api
69
import androidx.compose.material3.Icon
710
import androidx.compose.material3.IconButton
@@ -20,6 +23,7 @@ import app.passwordstore.ui.compose.preview.DevicePreviews
2023
import app.passwordstore.ui.compose.preview.ThemePreviews
2124
import app.passwordstore.ui.compose.theme.APSTheme
2225

26+
@SuppressLint("ComposableLambdaParameterNaming") // The lint doesn't really apply to `actions`
2327
@Composable
2428
@OptIn(ExperimentalMaterial3Api::class)
2529
public 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

Comments
 (0)