NumberInputWithIncrementDecrement constructor

NumberInputWithIncrementDecrement({
  1. required TextEditingController controller,
  2. Key? key,
  3. bool enabled = true,
  4. ButtonArrangement buttonArrangement = ButtonArrangement.rightEnd,
  5. num min = 0,
  6. num max = double.maxFinite,
  7. num initialValue = 0,
  8. num incDecFactor = 1,
  9. bool isInt = true,
  10. AutovalidateMode autovalidateMode = AutovalidateMode.always,
  11. bool enableMinMaxClamping = true,
  12. InputDecoration? numberFieldDecoration,
  13. Decoration? widgetContainerDecoration,
  14. FormFieldValidator<String>? validator,
  15. TextStyle? style,
  16. IconData incIcon = Icons.arrow_drop_up,
  17. IconData? decIcon = Icons.arrow_drop_down,
  18. int fractionDigits = 2,
  19. double scaleWidth = 1.0,
  20. double scaleHeight = 1.0,
  21. double? incIconSize,
  22. double? decIconSize,
  23. Color? decIconColor,
  24. Color? incIconColor,
  25. DiffIncDecCallBack? onDecrement,
  26. DiffIncDecCallBack? onIncrement,
  27. ValueCallBack? onSubmitted,
  28. ValueCallBack? onChanged,
  29. bool separateIcons = false,
  30. Decoration? decIconDecoration,
  31. Decoration? incIconDecoration,
  32. Color? incDecBgColor,
  33. TextAlign textAlign = TextAlign.center,
})

A simple widget that wraps a TextFormField, exposes it as a number field and adds buttons to increment and decrement the numeric value. Performs some basic validation, formatting to fractionDigits and clamping the values between min and max when enabled through enableMinMaxClamping.

e.g. Default widget appearance.

NumberInputWithIncrementDecrement

Implementation

NumberInputWithIncrementDecrement({
  required this.controller,
  this.key,
  this.enabled = true,
  this.buttonArrangement = ButtonArrangement.rightEnd,
  this.min = 0,
  this.max = double.maxFinite,
  this.initialValue = 0,
  this.incDecFactor = 1,
  this.isInt = true,
  this.autovalidateMode = AutovalidateMode.always,
  this.enableMinMaxClamping = true,
  this.numberFieldDecoration,
  this.widgetContainerDecoration,
  this.validator,
  this.style,
  this.incIcon = Icons.arrow_drop_up,
  this.decIcon = Icons.arrow_drop_down,
  this.fractionDigits = 2,
  this.scaleWidth = 1.0,
  this.scaleHeight = 1.0,
  this.incIconSize,
  this.decIconSize,
  this.decIconColor,
  this.incIconColor,
  this.onDecrement,
  this.onIncrement,
  this.onSubmitted,
  this.onChanged,
  this.separateIcons = false,
  this.decIconDecoration,
  this.incIconDecoration,
  this.incDecBgColor,
  this.textAlign = TextAlign.center,
});