NumberPicker.integer constructor
NumberPicker.integer({
- Key? key,
- required int initialValue,
- required int minValue,
- required int maxValue,
- required ValueChanged<
num> onChanged, - bool enabled = true,
- TextMapper? textMapper,
- double itemExtent = kDefaultItemExtent,
- double? listViewWidth = kDefaultListViewCrossAxisSize,
- int step = 1,
- Axis scrollDirection = Axis.vertical,
- bool zeroPad = false,
- bool highlightSelectedValue = true,
- Decoration? decoration,
- bool haptics = false,
- TextStyle? selectedRowStyle,
- TextStyle? unselectedRowStyle,
- bool? isShowMonthName = false,
- bool? isJalali = false,
constructor for integer number picker
Implementation
NumberPicker.integer({
Key? key,
required int initialValue,
required this.minValue,
required this.maxValue,
required this.onChanged,
this.enabled = true,
this.textMapper,
this.itemExtent = kDefaultItemExtent,
this.listViewWidth = kDefaultListViewCrossAxisSize,
this.step = 1,
this.scrollDirection = Axis.vertical,
this.zeroPad = false,
this.highlightSelectedValue = true,
this.decoration,
this.haptics = false,
this.selectedRowStyle,
this.unselectedRowStyle,
this.isShowMonthName = false,
this.isJalali = false,
}) : assert(maxValue >= minValue),
// assert(initialValue >= minValue && initialValue <= maxValue),
assert(step > 0),
selectedIntValue = (initialValue < minValue)
? minValue
: ((initialValue > maxValue) ? maxValue : initialValue),
selectedDecimalValue = -1,
decimalPlaces = 0,
intScrollController = ScrollController(
initialScrollOffset: (initialValue - minValue) ~/ step * itemExtent,
),
decimalScrollController = null,
listViewHeight = 3 * itemExtent,
integerItemCount = (maxValue - minValue) ~/ step + 1,
super(key: key) {
onChanged(selectedIntValue);
}