flutter_sleep_chart library
An Apple Health-style sleep stage chart widget for Flutter.
Classes
- HypnogramChart
- An Apple Health-style hypnogram: one glassy-halo bar row per stage, with gradient connectors between transitions and a scrub tooltip on hover/tap/drag.
- HypnogramLegend
- A standalone legend for a HypnogramChart's StageStyle map — a color dot + label per stage, for composing outside the chart itself.
- HypnogramTooltipConfig
- Configures the scrub tooltip's content and appearance.
- SleepStageSegment
- A single contiguous block of sleep at one type, from start to end.
- StageStyle
- Per-stage appearance: color, row label, and optional row height override.
Enums
- HypnogramInteractionMode
- How HypnogramChart reacts to pointer input.
- SleepStageType
- Sleep stage categories used to render a hypnogram.
Constants
-
kDefaultHypnogramStageStyles
→ const Map<
SleepStageType, StageStyle> - Default stage styles, top to bottom: awake, rem, light, deep.
-
kFallbackHypnogramStageStyles
→ const Map<
SleepStageType, StageStyle> -
Built-in styles for SleepStageType.inBed and SleepStageType.asleep —
used automatically by HypnogramChart (via resolveStageStyles) for
whichever of these appear in
segmentsbut aren't instageStyles, so they work out of the box without having to define them yourself.
Functions
-
resolveStageStyles(
Map< SleepStageType, StageStyle> stageStyles, List<SleepStageSegment> segments) → Map<SleepStageType, StageStyle> -
Backfills
stageStyleswith kFallbackHypnogramStageStyles entries for any type present insegmentsbut missing fromstageStyles— the same resolution HypnogramChart applies internally. Use this to build a HypnogramLegend that matches a chart relying on those defaults.