@@ -32,18 +32,24 @@ fun ExcludeIcon(
32
32
@DrawableRes icon : Int = if (exclude) excludeIcon else includeIcon,
33
33
@StringRes string : Int = if (exclude) includeString else excludeString,
34
34
@StringRes contentDescription : Int = if (exclude) excludeString else includeString,
35
- ) = PlainTooltipBox (
36
- tooltip = {
37
- androidx.compose.material3.Text (stringResource(string))
38
- },
39
- content = {
40
- Icon (
41
- painterResource(icon),
42
- stringResource(contentDescription),
43
- modifier = Modifier .tooltipTrigger()
44
- )
45
- }
46
- )
35
+ ) {
36
+ val tooltipState = rememberTooltipState()
37
+ val scope = rememberCoroutineScope()
38
+
39
+ PlainTooltipBox (
40
+ tooltip = {
41
+ androidx.compose.material3.Text (stringResource(string))
42
+ },
43
+ state = tooltipState,
44
+ content = {
45
+ Icon (
46
+ painterResource(icon),
47
+ stringResource(contentDescription),
48
+ modifier = Modifier .tooltipTrigger(onClick = { scope.launch { tooltipState.show() } })
49
+ )
50
+ }
51
+ )
52
+ }
47
53
48
54
@Composable
49
55
fun ExcludeSystemIcon (exclude : Boolean ) = ExcludeIcon (
@@ -118,16 +124,21 @@ fun BoxScope.InstallProgressIcon(
118
124
fun RefreshIcon (
119
125
text : String ,
120
126
modifier : Modifier = Modifier
121
- ) = PlainTooltipBox (
122
- tooltip = {
123
- androidx.compose.material3.Text (text)
124
- },
125
- tooltipState = rememberPlainTooltipState(),
126
- content = {
127
- Icon (
128
- painter = painterResource(id = R .drawable.ic_refresh),
129
- contentDescription = text,
130
- modifier = Modifier .tooltipTrigger().then(modifier)
131
- )
132
- }
133
- )
127
+ ) {
128
+ val tooltipState = rememberTooltipState()
129
+ val scope = rememberCoroutineScope()
130
+
131
+ PlainTooltipBox (
132
+ tooltip = {
133
+ androidx.compose.material3.Text (text)
134
+ },
135
+ state = tooltipState,
136
+ content = {
137
+ Icon (
138
+ painter = painterResource(id = R .drawable.ic_refresh),
139
+ contentDescription = text,
140
+ modifier = Modifier .tooltipTrigger(onClick = { scope.launch { tooltipState.show() } }).then(modifier)
141
+ )
142
+ }
143
+ )
144
+ }
0 commit comments