flutter_sleep_chart 0.3.1
flutter_sleep_chart: ^0.3.1 copied to clipboard
A lightweight, dependency-free Apple Health-style sleep stage chart widget for Flutter.
0.3.1 #
- Fixed a
prefer_interpolation_to_compose_stringslint in_formatDurationflagged by pub.dev's static analysis. - Consolidated the example app's Normal/Asleep/In Bed pages and shared
helpers into a single
main.dart— pub.dev's Example tab only renders that file, not files it imports, so the split across multiple files was hiding most of the usage from anyone browsing the package there.
0.3.0 #
- Breaking: replaced
haloBackgroundwithhaloOpacity. The halo is now a true translucent overlay of the stage color (alpha compositing) instead of an opaque blend toward an assumed background color, so it reads correctly against any background automatically — no more washed-out halos when the chart sits on a custom (e.g. dark) background that doesn't matchColorScheme.surface. - The scrub dot no longer erases the guide line with an assumed background color — the dashed line now leaves a gap around the dot instead, for the same background-agnostic reason.
- Added
SleepStageType.asleep— a coarse fallback for data sources that only distinguish asleep/awake without REM/Light/Deep detail. Use it in place ofrem/light/deep, not alongside them. - Added
StageStyle.spanRows— lets a stage type (e.g.asleep) skip getting its own row and instead render as a translucent halo+bar gradient spanning the combined vertical extent of other row types. - Added
StageStyle.gradientRows— lets thespanRowsgradient's colors (first → last) differ from the rows it visually spans, e.g. spanning REM/Light/Deep's full height while gradienting only REM → Light. - Added
SleepStageType.inBed— the overall in-bed span, an ordinary stage type with its own row, independent ofasleepand the finer stages. - Fixed stage-transition connector lines drawing between segments that
merely sit next to each other in the list but aren't actually
back-to-back in time (e.g. a spanning
inBedrow overlapping the whole night) — connectors now only draw between segments where one ends exactly where the next begins. asleep/inBednow work with zero extra config: ifsegmentsuses either type andstageStylesdoesn't define it,HypnogramChartautomatically backfills it fromkFallbackHypnogramStageStyles(sensible built-in color/label/spanRows/gradientRows). Exposed the merge logic asresolveStageStyles(stageStyles, segments)for building a matchingHypnogramLegendalongside a chart that relies on the defaults.- Fixed
showTimeAxis/showTimeGridLineslabels overlapping/garbling on wide time ranges (e.g. a 12-hour span) — hourly ticks now thin out automatically to whatever actually fits without overlapping. - Added
minHeight— when the natural row stack (e.g. a singleinBed-only row) is shorter than this, the rows are centered within it instead of the chart just being that short. No effect once rows already exceed it. - Breaking:
showRowGridLines/showTimeGridLinesnow default totrue(previouslyfalse), andshowTimeGridLinesnow draws dashed lines (previously solid) to read distinctly from the solid row dividers.
0.2.0 #
- Added
onSegmentTap— called with the segment under the pointer on every pointer-down. - Added
showTimeAxis/timeAxisHeightfor hour-aligned clock labels below the chart. - Added
showRowGridLines/showTimeGridLines/gridLineColorfor optional row-divider and hourly grid lines. - Added
HypnogramLegend, a standalone color-dot + label legend widget for astageStylesmap. - Added
interactionMode(HypnogramInteractionMode.scrub(default) or.tap) —.tapignores pointer-move so the chart doesn't fight a scrollable/draggable parent. - Added
enableAnimation/animationDuration/animationCurve— bars now animate in on first render and wheneversegmentschanges (on by default). - Added
emptyBuilderfor a custom placeholder whensegmentsis empty.
0.1.0 #
- Breaking: replaced the
colors/stageOrder/labelsmaps with a singlestageStyles: Map<SleepStageType, StageStyle>— color, label, and an optional per-stagerowHeightoverride, in one place. Row order now follows the map's iteration order. - Added
HypnogramTooltipConfig(tooltip:param) to customize the scrub tooltip: per-field text overrides (labelText/timeRangeText/durationText), bubble styling (background, text styles, padding, border radius, shadow, color-dot toggle), or a fullbuilderoverride. - Added
labelColumnWidthparam (previously a hardcoded constant). - Fixed the tooltip floating above the chart's own bounds — it now clamps to the chart area and flips below the anchor row when there's no room above.
0.0.1 #
- Initial release:
HypnogramChartwidget — per-stage rows with glassy halo bars, gradient stage-transition connectors, minimum-width clamping for short segments, and a scrub tooltip (hover/tap/drag) with a guide line and stage-colored dot.