CupertinoPicker constructor
Creates a picker from a concrete list of children.
The diameterRatio
and itemExtent
arguments must not be null. The
itemExtent
must be greater than zero.
The backgroundColor
defaults to light gray. It can be set to null to
disable the background painting entirely; this is mildly more efficient
than using Colors.transparent. Also, if it has transparency, no gradient
effect will be rendered.
The looping
argument decides whether the child list loops and can be
scrolled infinitely. If set to true, scrolling past the end of the list
will loop the list back to the beginning. If set to false, the list will
stop scrolling when you reach the end or the beginning.
Implementation
CupertinoPicker({
Key key,
this.diameterRatio = _kDefaultDiameterRatio,
this.backgroundColor = _kDefaultBackground,
this.offAxisFraction = 0.0,
this.useMagnifier = false,
this.magnification = 1.0,
this.scrollController,
@required this.itemExtent,
@required this.onSelectedItemChanged,
@required List<Widget> children,
bool looping = false,
}) : assert(children != null),
assert(diameterRatio != null),
assert(diameterRatio > 0.0, RenderListWheelViewport.diameterRatioZeroMessage),
assert(magnification > 0),
assert(itemExtent != null),
assert(itemExtent > 0),
childDelegate = looping
? ListWheelChildLoopingListDelegate(children: children)
: ListWheelChildListDelegate(children: children),
super(key: key);