refactor(ui): BottomSheet sur anchoredDraggable (fling + tap fiable) #9
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
CyrilLeblanc/gresit#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contexte
Le drawer utilise un geste écrit à la main dans un seul
pointerInput(ui/components/BottomSheet.kt:117-163). Deux défauts qui en découlent :collapseThresholdPx(:129-150), animée via untween(300ms)fixe (:92). Aucune vélocité prise en compte → un flick rapide ne porte pas d'impulsion, on ne peut pas « lancer » le drawer pour l'ouvrir/fermer vite.down.consume()+isDragging = trueimmédiatement audown(:120-121), zéro slop. Le bouton « Itinéraire » (StopContent.kt:168-183, rendu viapeekContentdans laColumnqui porte lepointerInput) est donc intercepté dès la première frame ; sur les écrans haut FPS le micro-tremblement accumule des deltas (:152) → le tap est compté comme drag et le.clickablene déclenche pas.Comportement attendu
Remplacer le geste maison par
anchoredDraggable(AnchoredDraggableState<SheetState>+DraggableAnchors), qui apporte nativement fling + discrimination tap/drag (slop).canHide(PEEK→HIDDEN hors EXPLORE),onHeightChange(padding carte), peek content custom.Pistes d'implémentation
AnchoredDraggableState<SheetState>(initialValue = sheetState, …)+DraggableAnchorsà 0 / peekPx / midPx / fullPx viastate.updateAnchors(...)dans leBoxWithConstraints(ancres dépendent de la hauteur dispo + navBar).Modifier.anchoredDraggable(state, orientation = Vertical)sur la Column du drawer, en lieu et place dupointerInputmaison.onHeightChange: réagir àstate.requireOffset()(ousnapshotFlowsur l'offset) pour pousser la hauteur courante (drag + animation).SheetStateexterne (sheetState/onStateChange) avecanchoredDraggableState.settledTarget/targetState.anchoredDraggabledans la BOM Compose actuelle (libs.versions.toml) ; monter la version si besoin.pointerInput(:117-163),isDragging,dragHeightPxet la logique de snap manuelle.Critères d'acceptation
canHidefonctionnent comme avant.onHeightChangecontinue de piloter le padding carte pendant le drag et l'animation.pointerInput/isDragging/ snap manuel dansBottomSheet.kt.assembleDebug/assembleReleaseOK ; pas de régression visuelle ni fonctionnelle (ETAs au drag, Plan).