Skip to content

Instantly share code, notes, and snippets.

@vitoksmile
vitoksmile / HintController.kt
Created February 11, 2025 18:09
ComposeHints
@Stable
class HintController internal constructor() {
private var queue = mutableStateListOf<HintAnchorState>()
internal val hint: HintAnchorState? get() = queue.firstOrNull()
private val pendingRequests = mutableMapOf<HintAnchorState, Continuation<Unit>>()
suspend fun show(hint: HintAnchorState) {
@vitoksmile
vitoksmile / HintOverlay.kt
Created February 11, 2025 18:09
ComposeHints
@Composable
internal fun HintOverlay(
anchor: HintAnchorState,
onDismiss: () -> Unit,
) {
Popup(
onDismissRequest = onDismiss,
// Set focusable to handle back press events
properties = remember { PopupProperties(focusable = true) },
) {
@vitoksmile
vitoksmile / HintController.kt
Created February 11, 2025 18:08
ComposeHints
@Stable
class HintController internal constructor() {
internal var hint by mutableStateOf<HintAnchorState?>(null)
fun show(hint: HintAnchorState) {
this.hint = hint
}
fun dismiss() {
@vitoksmile
vitoksmile / HintController.kt
Created February 11, 2025 18:08
ComposeHints
@Composable
fun rememberHintController(overlay: Brush): HintController {
return rememberHintController(overlay = LocalHintOverlayBrush provides overlay)
}
@Composable
fun rememberHintController(overlay: Color = HintOverlayColorDefault): HintController {
return rememberHintController(overlay = LocalHintOverlayColor provides overlay)
}
{
"basics": {
"name": "Thomas Edison",
"label": "Inventor and Businessman",
"picture": "https://example.com/photo.jpg",
"email": "thomas.edison@example.com",
"phone": "(123) 456-7890",
"website": "https://thomasedison.com",
"summary": "Prolific inventor and businessman known for developing many devices that greatly influenced life around the world, including the phonograph, the motion picture camera, and the electric light bulb.",
"location": {
@prakhart111
prakhart111 / main.dart
Created February 11, 2025 18:08
Snippet created via Next.js API
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@vitoksmile
vitoksmile / App.kt
Created February 11, 2025 18:08
ComposeHints
val hintController = rememberHintController()
IconButton(
modifier = Modifier
.hintAnchor(topAppBarActionHintAnchor, CircleShape),
onClick = {
hintController.show(topAppBarActionHintAnchor)
},
)
@vitoksmile
vitoksmile / HintController.kt
Created February 11, 2025 18:07
ComposeHints
@Stable
class HintController internal constructor() {
internal var hint by mutableStateOf<HintAnchorState?>(null)
fun show(hint: HintAnchorState) {
this.hint = hint
}
}
@Schoolads
Schoolads / gist:39ad5e1ffb89efcdd9da866ca7404130
Created February 11, 2025 18:07
School of Nursing, UCH, Ibadan 2025/2026 {O8125777035} Admission Form Is STILL ON SALE.. Call DR.MRS ALICE OGUNSOLA on {O8125777035}.The Management of the school hereby inform the general public of the sales of the general Nursing Admission form into the School of Nursing, Also midwifery, post-basic midwifery form, post-basic nursing form and in…
School of Nursing, UCH, Ibadan 2025/2026 {O8125777035} Admission Form Is STILL ON SALE.. Call DR.MRS ALICE OGUNSOLA on {O8125777035}.The Management of the school hereby inform the general public of the sales of the general Nursing Admission form into the School of Nursing, Also midwifery, post-basic midwifery form, post-basic nursing form and internship form are still on sale for more information on purchase of the form and admission assistance call Admin Officer{O8125777035}
@vitoksmile
vitoksmile / HintsContainer.kt
Created February 11, 2025 18:07
ComposeHints
@Composable
internal fun HintsContainer(
modifier: Modifier,
anchors: () -> List<HintAnchorState>,
) {
val anchors = anchors()
Layout(
modifier = modifier
.overlayBackground(anchors),