SpinBox class

A material design spinbox.

A numeric input widget with an input field for entering a specific value, and spin buttons for quick, convenient, and accurate value adjustments.

SpinBox

import 'package:flutter_spinbox/material.dart'; // or flutter_spinbox.dart for both

SpinBox(
  min: 1,
  max: 100,
  value: 50,
  onChanged: (value) => print(value),
)

See also Material Components widgets package.

Inheritance

Constructors

SpinBox.new({Key? key, double min = 0, double max = 100, double step = 1, double? pageStep, double value = 0, Duration interval = const Duration(milliseconds: 100), double? acceleration, int decimals = 0, int digits = 0, bool? enabled, bool readOnly = false, bool autofocus = false, TextInputType? keyboardType, TextInputAction? textInputAction, InputDecoration? decoration, FormFieldValidator<String>? validator, Brightness? keyboardAppearance, Icon? incrementIcon, Icon? decrementIcon, double? iconSize, MaterialStateProperty<Color?>? iconColor, bool showButtons = true, Axis direction = Axis.horizontal, TextAlign textAlign = TextAlign.center, TextDirection textDirection = TextDirection.ltr, TextStyle? textStyle, EditableTextContextMenuBuilder? contextMenuBuilder, bool? showCursor, Color? cursorColor, bool enableInteractiveSelection = true, double spacing = 8, ValueChanged<double>? onChanged, void onSubmitted(double)?, bool canChange(double value)?, VoidCallback? beforeChange, VoidCallback? afterChange, FocusNode? focusNode})
Creates a spinbox.

Properties

acceleration double?
The amount of acceleration that is added to the value on each step.
final
afterChange VoidCallback?
final
autofocus bool
See TextField.autofocus.
final
beforeChange VoidCallback?
final
canChange bool Function(double value)?
final
contextMenuBuilder EditableTextContextMenuBuilder?
See TextField.contextMenuBuilder.
final
cursorColor Color?
See TextField.cursorColor.
final
decimals int
The number of decimal places used for formatting the value.
final
decoration InputDecoration?
See TextField.decoration.
final
decrementIcon Icon
The visual icon for the decrement button.
final
digits int
The number of digits used for formatting the value.
final
direction Axis
The visual direction of the spinbox layout.
final
enabled bool
See TextField.enabled.
final
enableInteractiveSelection bool
See TextField.enableInteractiveSelection.
final
focusNode FocusNode?
See TextField.focusNode.
final
hashCode int
The hash code for this object.
no setterinherited
iconColor MaterialStateProperty<Color?>?
The color to use for incrementIcon and decrementIcon.
final
iconSize double?
The size to use for incrementIcon and decrementIcon.
final
incrementIcon Icon
The visual icon for the increment button.
final
interval Duration
The interval used for auto-incrementing and -decrementing.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardAppearance Brightness?
See TextField.keyboardAppearance.
final
keyboardType TextInputType
See TextField.keyboardType.
final
max double
The maximum value the user can enter.
final
min double
The minimum value the user can enter.
final
onChanged ValueChanged<double>?
Called when the user has changed the value.
final
onSubmitted → void Function(double)?
See TextField.onSubmitted.
final
pageStep double?
An optional page step size for incrementing and decrementing the value.
final
readOnly bool
See TextField.readOnly.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showButtons bool
Whether the increment and decrement buttons are shown.
final
showCursor bool?
See TextField.showCursor.
final
spacing double
The visual spacing of the spinbox layout.
final
step double
The step size for incrementing and decrementing the value.
final
textAlign TextAlign
See TextField.textAlign.
final
textDirection TextDirection
See TextField.textDirection.
final
textInputAction TextInputAction?
See TextField.textInputAction.
final
textStyle TextStyle?
See TextField.style.
final
validator FormFieldValidator<String>?
See FormField.validator.
final
value double
The current value.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SpinBox>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited