Skip to content

WaterDropHeader

WaterDropHeader renders a playful water-droplet that stretches downward as you pull and snaps back with a ripple when released. It is one of the most visually distinctive headers bundled with smart_refresher.


SmartRefresher(
controller: _controller,
header: const WaterDropHeader(),
onRefresh: _onRefresh,
child: ListView.builder(...),
)

PropertyTypeDefaultDescription
colorColorColors.whiteFill color of the water drop.
inertiaDistancedouble0.0Extra inertia stretch distance beyond the trigger threshold.
completeIconWidget?Icon(Icons.done, color: Colors.grey)Widget shown on successful refresh completion.
failedIconWidget?Icon(Icons.close, color: Colors.grey)Widget shown on failed refresh.
completeDurationDuration600msTime the complete/failed state is visible before dismissal.
waterDropColorColorconst Color(0xFF00BFFF)Color of the animated drop itself.
idleIconWidget?nullOptional icon overlaid in the idle drop.
heightdouble60.0Height reserved for the header.

WaterDropHeader(
waterDropColor: Colors.indigo,
color: Colors.white,
)
WaterDropHeader(
completeIcon: const Icon(Icons.cloud_done, color: Colors.green),
failedIcon: const Icon(Icons.cloud_off, color: Colors.red),
completeDuration: const Duration(milliseconds: 800),
)

The header uses a Bezier-curve path to simulate the elastic water surface:

  1. Idle → Drag: The drop elongates vertically proportional to the pull offset.
  2. Threshold crossed: The neck of the drop narrows, simulating surface tension.
  3. Release: The drop detaches with a elastic snap and a circular ripple appears.
  4. Refreshing → Complete: A spinner plays, then the completion icon fades in.

A material-flavored variant is also available:

SmartRefresher(
header: WaterDropMaterialHeader(
backgroundColor: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.onPrimary,
),
...
)

WaterDropMaterialHeader wraps a CircularProgressIndicator inside the drop and matches the Material Design elevation and color system.

PropertyTypeDefaultDescription
backgroundColorColorTheme primaryDrop background / container fill.
colorColorColors.whiteProgress indicator color.
distancedouble50.0Vertical travel distance of the drop before snapping.
offsetdouble0.0Horizontal offset of the drop from center.