Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ToastEffect #1223

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Implement ToastEffect #1223

merged 1 commit into from
Feb 21, 2024

Conversation

ZacSweers
Copy link
Collaborator

A composable function that returns a lambda to show a [Toast]. Any previously shown toast will be cancelled when a new one is shown or this composable exits composition. The returned lambda can be called with the text to show in the toast.

val showToast = toastEffect()
// ...
Button(onClick = { showToast("Hello, world!") }) {
  Text("Show Toast")
}

A composable function that returns a lambda to show a [Toast]. Any previously shown toast will be cancelled when a new one is shown or this composable exits composition. The returned lambda can be called with the text to show in the toast.

```kotlin
val showToast = toastEffect()
// ...
Button(onClick = { showToast("Hello, world!") }) {
  Text("Show Toast")
}
```
@ZacSweers ZacSweers requested a review from stagg February 21, 2024 17:23
@ZacSweers
Copy link
Collaborator Author

I don't really know how to test toasts as they wouldn't show up in a snapshot given they're in the sysui, so going to run with just this as-is. Maybe if we add a circuitx playground sample we can just put an example there.

@ZacSweers ZacSweers added this pull request to the merge queue Feb 21, 2024
Merged via the queue into main with commit 727d2a2 Feb 21, 2024
5 checks passed
@ZacSweers ZacSweers deleted the z/toastEffect branch February 21, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants