You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-16Lines changed: 49 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,10 +41,6 @@
41
41
<imgsrc="docs/assets/demo_1_2.gif"alt="GuideKit demo showing alternate styling and circular highlights"width="320" />
42
42
</p>
43
43
44
-
<palign="center">
45
-
Both demos showcase the same core idea: GuideKit renders polished tours above your real Compose UI while your app provides measured targets and callbacks.
46
-
</p>
47
-
48
44
---
49
45
50
46
## Installation
@@ -70,32 +66,69 @@ kotlin {
70
66
71
67
## Quick Start
72
68
73
-
Measure a target, describe a step, and let GuideKit render the overlay.
69
+
Add GuideKit to the **main composable that occupies the full screen**. It does not matter whether your screen uses a `Scaffold`, a `Box`, or another layout. The guide should be placed at the screen's top level so it can draw above all of its content.
70
+
71
+
### 1. Keep the external values in the parent screen
72
+
73
+
Store the measured bounds of the composable you want to highlight. This minimal example uses `rememberSaveable` for guide visibility, but you can use any persistence approach you prefer, such as a ViewModel backed by DataStore or a database, to prevent completed guides from appearing again.
74
74
75
75
```kotlin
76
-
@Composable
77
-
funProductScreen() {
78
-
val targets = remember { mutableStateMapOf<String, Rect>() }
79
-
var showTour by remember { mutableStateOf(true) }
76
+
var targetBounds by remember { mutableStateOf<Rect?>(null) }
77
+
var showGuide by rememberSaveable { mutableStateOf(true) }
78
+
```
80
79
81
-
Box(Modifier.fillMaxSize()) {
82
-
PrimaryButton(
80
+
### 2. Measure the UI you want to highlight
81
+
82
+
Pass a bounds callback into the child composable that contains the target. Attach `onGloballyPositioned` to the target itself and send its measured bounds back through that callback.
### 3. Place GuideKit at the full-screen parent level
104
+
105
+
Place `GuideKit` in the full-size parent composable, after the screen content. The parent owns `targetBounds` and passes its update callback into `MainScreenContent`. This lets a target inside any nested composable send its bounds to the parent without moving the target itself.
106
+
107
+
```kotlin
108
+
@Composable
109
+
funMainScreen() {
110
+
var targetBounds by remember { mutableStateOf<Rect?>(null) }
111
+
var showGuide by rememberSaveable { mutableStateOf(true) }
0 commit comments