SpinBox constructor
SpinBox({
- Key? key,
- double min = 0,
- double max = 100,
- double step = 1,
- double value = 0,
- Duration interval = const Duration(milliseconds: 100),
- double? acceleration,
- int numOfDecimals = 0,
- bool? enabled,
- bool autofocus = false,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- InputDecoration? decoration,
- FormFieldValidator<
String> ? validator, - Brightness? keyboardAppearance,
- Icon? incrementIcon,
- Icon? decrementIcon,
- Axis direction = Axis.horizontal,
- TextAlign textAlign = TextAlign.center,
- TextDirection textDirection = TextDirection.ltr,
- TextStyle? textStyle,
- ToolbarOptions? toolbarOptions,
- bool? showCursor,
- Color? cursorColor,
- bool enableInteractiveSelection = true,
- double spacing = 8,
- ValueChanged<
double?> ? onChanged,
Creates a spinbpx.
Implementation
SpinBox({
Key? key,
this.min = 0,
this.max = 100,
this.step = 1,
this.value = 0,
this.interval = const Duration(milliseconds: 100),
this.acceleration,
this.numOfDecimals = 0,
bool? enabled,
this.autofocus = false,
TextInputType? keyboardType,
this.textInputAction,
InputDecoration? decoration,
this.validator,
this.keyboardAppearance,
Icon? incrementIcon,
Icon? decrementIcon,
this.direction = Axis.horizontal,
this.textAlign = TextAlign.center,
this.textDirection = TextDirection.ltr,
this.textStyle,
this.toolbarOptions,
this.showCursor,
this.cursorColor,
this.enableInteractiveSelection = true,
this.spacing = 8,
this.onChanged,
}) : keyboardType = keyboardType ??
TextInputType.numberWithOptions(
signed: min < 0,
decimal: numOfDecimals > 0,
),
enabled = (enabled ?? true) && min < max,
decoration = decoration ?? const InputDecoration(),
incrementIcon = incrementIcon ?? const Icon(Icons.add),
decrementIcon = decrementIcon ?? const Icon(Icons.remove),
super(key: key) {
assert(this.decoration.prefixIcon == null,
'InputDecoration.prefixIcon is reserved for SpinBox decrement icon');
assert(this.decoration.suffixIcon == null,
'InputDecoration.suffixIcon is reserved for SpinBox increment icon');
}