ListVisualisation.wheel constructor

ListVisualisation.wheel({
  1. double wheelPixelRadius = 600,
})

Displays items in an SnappyListView like a wheel. The size of the wheel can be configured by wheelPixelRadius. If the wheel radius is below 0 the wheel gets mirrored.

Implementation

ListVisualisation.wheel({
  double wheelPixelRadius = 600,
}) : _parameters = ((item) {
        double degrees = 0;
        Offset offset = Offset.zero;
        if (item.isInBuilderSizes) {
          //The degrees is determined by the Degrees by the distance to the
          //current page (0) of the perimeter
          degrees = 360 /
              ((2 * pi * wheelPixelRadius) / item.distanceToCurrentPage!);
          offset = item.axis == Axis.horizontal
              ? Offset(-item.distanceToCurrentPage!, wheelPixelRadius)
              : Offset(-wheelPixelRadius, -item.distanceToCurrentPage!);
        }
        return ListVisualisationParameters(
          transform: Matrix4Transform()
              .rotateDegrees(degrees, origin: offset)
              .matrix4,
          curve: Curves.linear,
          duration: const Duration(milliseconds: 0),
        );
      });