buildRefreshIndicator static method

Widget buildRefreshIndicator(
  1. BuildContext context,
  2. RefreshIndicatorMode refreshState,
  3. double pulledExtent,
  4. double refreshTriggerPullDistance,
  5. double refreshIndicatorExtent,
)

Implementation

static Widget buildRefreshIndicator(
  BuildContext context,
  RefreshIndicatorMode refreshState,
  double pulledExtent,
  double refreshTriggerPullDistance,
  double refreshIndicatorExtent,
) {
  Widget widget;
  double width = min(22, pulledExtent);
  if (refreshState == RefreshIndicatorMode.refresh) {
    widget = SizedBox(
      child: const CircularProgressIndicator(strokeWidth: 2),
      width: width,
      height: width,
    );
  } else {
    widget = Transform.rotate(
      angle: pulledExtent / 80 * 6.28,
      child: const CircularProgressIndicator(
        value: .85,
        strokeWidth: 2,
      ),
    );
  }
  return Center(
    child: SizedBox(
      width: width,
      height: width,
      child: Padding(padding: const EdgeInsets.all(2.0), child: widget),
    ),
  );
}