Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created June 21, 2022 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmmanuelGuther/c18da4665f84b9d476f3e63f8877cbeb to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/c18da4665f84b9d476f3e63f8877cbeb to your computer and use it in GitHub Desktop.
@Composable
fun TopAppBar(modifier: Modifier, backgroundColor: Color, onClickProfile: () -> Unit, onSearch: (String) -> Unit) {
TopAppBar(title = {
Row {
Text(
text = "AUDI APP STORE",
color = MaterialTheme.colors.onPrimary,
modifier = Modifier
.fillMaxWidth()
.height(60.dp)
.padding(16.dp),
textAlign = TextAlign.Center,
fontSize = 24.sp,
fontWeight = FontWeight.Bold
)
}
}, backgroundColor = backgroundColor, actions = {
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
IconButton(onClick = { /* TODO: Open search */ }) {
Icon(
imageVector = Icons.Filled.Search, contentDescription = "", tint = MaterialTheme.colors.onPrimary
)
}
IconButton(onClick = { onClickProfile.invoke() }) {
Icon(
imageVector = Icons.Default.AccountCircle, tint = MaterialTheme.colors.onPrimary, contentDescription = ""
)
}
}
}, modifier = modifier
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment