StacSlider class

A Stac model representing Flutter's Slider widget.

A Material Design slider allows users to select a value from a range of values by moving the slider thumb. Supports Material, Cupertino, and adaptive variants selected by sliderType.

{@tool snippet} Dart Example:

StacSlider(
  id: 'volume',
  value: 0.5,
  min: 0.0,
  max: 1.0,
  onChanged: StacAction.fromJson({'type': 'setValue', 'key': 'volume'}),
  activeColor: StacColors.blue,
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "slider",
  "id": "volume",
  "value": 0.5,
  "min": 0.0,
  "max": 1.0,
  "activeColor": "#2196F3"
}

{@end-tool}

See also:

Inheritance
Annotations
  • @JsonSerializable(explicitToJson: true)

Constructors

StacSlider.new({String? id, StacSliderType? sliderType, required double value, double? secondaryTrackValue, StacAction? onChanged, StacAction? onChangeStart, StacAction? onChangeEnd, double? min, double? max, int? divisions, String? label, StacColor? activeColor, StacColor? inactiveColor, StacColor? secondaryActiveColor, StacColor? thumbColor, StacColor? overlayColor, StacMouseCursor? mouseCursor, bool? autofocus, StacSliderInteraction? allowedInteraction})
Creates a StacSlider.
const
StacSlider.fromJson(Map<String, dynamic> json)
Creates a StacSlider from a JSON map.
factory

Properties

activeColor StacColor?
The color of the active portion of the slider track.
final
allowedInteraction StacSliderInteraction?
How the slider responds to user interaction.
final
autofocus bool?
Whether this slider should focus itself if nothing else is focused.
final
divisions int?
The number of discrete divisions.
final
hashCode int
The hash code for this object.
no setterinherited
id String?
Identifier used with form scope to store/read this slider's value.
final
inactiveColor StacColor?
The color of the inactive portion of the slider track.
final
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
label String?
A label to show above the slider's thumb.
final
max double?
The maximum value the user can select.
final
min double?
The minimum value the user can select.
final
mouseCursor StacMouseCursor?
The mouse cursor to display when hovering this widget.
final
onChanged StacAction?
Action invoked when the user drags to a new value.
final
onChangeEnd StacAction?
Action invoked when the user ends a change sequence.
final
onChangeStart StacAction?
Action invoked when the user starts a change sequence.
final
overlayColor StacColor?
The color of the overlay drawn when the thumb is pressed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondaryActiveColor StacColor?
The color of the secondary active portion of the slider track.
final
secondaryTrackValue double?
The current value of the secondary track, if any.
final
sliderType StacSliderType?
Which platform style of slider to render.
final
thumbColor StacColor?
The color of the thumb.
final
type String
Widget type identifier.
no setteroverride
value double
The current value of the slider.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this StacSlider instance to a JSON map.
override
toString() String
A string representation of this object.
inherited

Operators

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