Skip to content

Commit

Permalink
Merge branch 'main' into search-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeroseman authored Feb 25, 2025
2 parents 79fcb85 + 7251dec commit bb14147
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.rememberTooltipState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch

@Composable
fun TooltipExamples() {
Expand Down Expand Up @@ -147,6 +147,7 @@ fun AdvancedRichTooltipExample(
richTooltipActionText: String = "Dismiss"
) {
val tooltipState = rememberTooltipState()
val coroutineScope = rememberCoroutineScope()

TooltipBox(
modifier = modifier,
Expand All @@ -156,7 +157,11 @@ fun AdvancedRichTooltipExample(
title = { Text(richTooltipSubheadText) },
action = {
Row {
TextButton(onClick = { tooltipState.dismiss() }) {
TextButton(onClick = {
coroutineScope.launch {
tooltipState.dismiss()
}
}) {
Text(richTooltipActionText)
}
}
Expand All @@ -168,7 +173,11 @@ fun AdvancedRichTooltipExample(
},
state = tooltipState
) {
IconButton(onClick = { tooltipState.dismiss() }) {
IconButton(onClick = {
coroutineScope.launch {
tooltipState.show()
}
}) {
Icon(
imageVector = Icons.Filled.Camera,
contentDescription = "Open camera"
Expand Down

0 comments on commit bb14147

Please sign in to comment.