JasCodes/list_wheel_scroll_view_x

ListWheelChildBuilderDelegate missing childCount

stefanoromanello opened this issue · 1 comments

I suggest adding the childCount when a delegate has been provided. Otherwise the listwheel has infinite elements.

final _childDelegate = children != null
        ? ListWheelChildListDelegate(
            children: children.map((child) {
            return RotatedBox(
              quarterTurns: scrollDirection == Axis.horizontal ? 1 : 0,
              child: child,
            );
          }).toList())
        : ListWheelChildBuilderDelegate(
            childCount: childDelegate.estimatedChildCount,
            builder: (context, index) {
              return RotatedBox(
                quarterTurns: scrollDirection == Axis.horizontal ? 1 : 0,
                child: childDelegate.build(context, index),
              );
            },
          );

It was my requirement to have infinite builder at the moment and probably forgot later. Will update when I get time to do so.