-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.composables.composetheme | ||
|
||
import androidx.compose.ui.input.pointer.PointerIcon | ||
|
||
internal actual val PlatformPointerIcon: PointerIcon = PointerIcon.Default |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.composables.composetheme | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.staticCompositionLocalOf | ||
import androidx.compose.ui.input.pointer.PointerIcon | ||
|
||
internal val LocalPlatformPointer = staticCompositionLocalOf { PointerIcon.Default } | ||
internal expect val PlatformPointerIcon: PointerIcon | ||
|
||
/** | ||
* [PointerIcon] used to indicate the hovered item is interactive. The icon displayed depends on the platform the icon will be used on. | ||
* | ||
* For example, this will show a [PointerIcon.Hand] icon when used on web vs a [PointerIcon.Default] icon on desktop. | ||
*/ | ||
val PointerIcon.Companion.PlatformPointer: PointerIcon | ||
@Composable get() { | ||
return LocalPlatformPointer.current | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.composables.composetheme | ||
|
||
import androidx.compose.ui.input.pointer.PointerIcon | ||
|
||
internal actual val PlatformPointerIcon: PointerIcon = PointerIcon.Default |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.composables.composetheme | ||
|
||
import androidx.compose.ui.input.pointer.PointerIcon | ||
|
||
internal actual val PlatformPointerIcon: PointerIcon = PointerIcon.Hand |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.composables.composetheme | ||
|
||
import androidx.compose.ui.input.pointer.PointerIcon | ||
|
||
internal actual val PlatformPointerIcon: PointerIcon = PointerIcon.Default |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.composables.composetheme | ||
|
||
import androidx.compose.ui.input.pointer.PointerIcon | ||
|
||
internal actual val PlatformPointerIcon: PointerIcon = PointerIcon.Hand |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.composables.composetheme.samples | ||
|
||
import androidx.compose.foundation.text.BasicText | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.input.pointer.PointerIcon | ||
import androidx.compose.ui.input.pointer.pointerHoverIcon | ||
import com.composables.composetheme.PlatformPointer | ||
|
||
@Composable | ||
fun PointerIconDemo() { | ||
BasicText(text = "Hover over me", modifier = Modifier.pointerHoverIcon(PointerIcon.PlatformPointer)) | ||
} |