Last active
November 5, 2023 13:55
-
-
Save saurabharora90/f1fc38b795020f0f8768fb9eb923f3e8 to your computer and use it in GitHub Desktop.
Derived State of Blog Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun PostHashtags( | |
hashtags: ImmutableList<String>, | |
onAddHashTag: (String) -> Unit, | |
modifier: Modifier | |
) { | |
var inputHashTag by remember(hashtags) { mutableStateOf("") } | |
Column(modifier = modifier) { | |
OutlinedTextField( | |
value = inputHashTag, | |
onValueChange = { inputHashTag = it }, | |
leadingIcon = { Text(text = "#", fontWeight = FontWeight.Bold) }, | |
placeholder = { Text(text = "Type a hashtag here") }, | |
trailingIcon = { | |
IconButton(onClick = { onAddHashTag(inputHashTag) }) { | |
Icon(imageVector = Icons.Default.AddCircle, | |
contentDescription = "Add hashtag") | |
} | |
}, | |
) | |
ReusableVerticalLazyList(content = hashtags) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment