Skip to content

BezierHeader & BezierCircleHeader

BezierHeader and BezierCircleHeader render a morphing Bezier-curve wave at the top of the scroll view. As you pull, the wave stretches; on release, it springs back with a fluid elastic motion.


// Flat header with a wave + spinner
SmartRefresher(
header: BezierHeader(
bezierAlign: BezierAlign.bottom,
child: Center(child: CircularProgressIndicator(color: Colors.white)),
),
...
)
// Circle variant — shows a floating disc with a spinner
SmartRefresher(
header: const BezierCircleHeader(),
...
)

PropertyTypeDefaultDescription
colorColorColors.blueFill color of the Bezier wave.
bezierAlignBezierAlign.bottomWhether the control point pulls from the top or bottom.
childWidget?nullWidget placed inside the wave (e.g., a spinner or logo).
heightdouble80.0Height reserved for the header.
completeDurationDuration500msHow long the complete state is shown.
enableFollowWhenNoFreezeboolfalseIf true, the header follows the list during the refresh animation.
ValueEffect
.topControl point anchored at the top — deep pull curve.
.bottomControl point anchored at the bottom — shallow wave (default).

PropertyTypeDefaultDescription
colorColorColors.blueDisc and background fill color.
childWidget?CircularProgressIndicator(white)Content inside the floating disc.
heightdouble80.0Height reserved for the header.
completeDurationDuration500msHow long the complete state is shown.

BezierHeader(
color: const Color(0xFF7C3AED), // purple
bezierAlign: BezierAlign.bottom,
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
CircularProgressIndicator(color: Colors.white, strokeWidth: 2),
SizedBox(width: 12),
Text('Loading...', style: TextStyle(color: Colors.white)),
],
),
)
BezierCircleHeader(
color: Colors.teal,
child: const Icon(Icons.refresh, color: Colors.white),
)

The header draws a CustomPainter using a cubic Bezier path whose control point is offset vertically by the current scroll offset:

  • At rest: a flat line (no wave visible).
  • During pull: the midpoint of the curve is pulled down proportional to dragOffset, forming the wave.
  • On release: AnimationController springs the control point back to zero using a physics-based SpringSimulation.