Skip to content
On this page

Slider

An adjustable numeric control with single-value and range modes.

Slider in FluttyUISlider in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

Usage

Use this expression inside a stateful widget. Keep the current value in your widget state and update it in the callback.

ui.Slider(
  value: volume,
  min: 0,
  max: 100,
  onChanged: (value) => setState(() => volume = value),
)

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

Slider

const Slider({
  super.key,
  this.motion,
  this.size,
  required this.value,
  required this.onChanged,
  this.min = 0,
  this.max = 100,
  this.divisions,
  this.mode = SliderMode.single,
  this.rangeValues,
  this.onRangeChanged,
  this.activeColor,
  this.inactiveColor,
  this.thumbColor = const Color(0xFFFFFFFF),
  this.disabledColor,
  this.trackHeight,
  this.thumbRadius,
  this.thumbHeight,
  this.showValue = false,
  this.valuePopoverOffset = 8,
  this.labelBuilder,
  this.title,
  this.maxLabel,
  this.showTicks = true,
  this.tickCount = 9,
  this.marks = const [],
});
ParameterTypeRequiredDefault
keyKey?Nonull
motionComponentMotion?Nonull
sizeComponentSize?Nonull
valuedoubleYes—
onChangedValueChanged<double>?Yes—
mindoubleNo0
maxdoubleNo100
divisionsint?Nonull
modeSliderModeNoSliderMode.single
rangeValuesSliderRangeValues?Nonull
onRangeChangedValueChanged<SliderRangeValues>?Nonull
activeColorColor?Nonull
inactiveColorColor?Nonull
thumbColorColorNoconst Color(0xFFFFFFFF)
disabledColorColor?Nonull
trackHeightdouble?Nonull
thumbRadiusdouble?Nonull
thumbHeightdouble?Nonull
showValueboolNofalse
valuePopoverOffsetdoubleNo8
labelBuilderString Function(double value)?Nonull
titleString?Nonull
maxLabelString?Nonull
showTicksboolNotrue
tickCountintNo9
marksList<SliderMark>Noconst []

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/controls/slider/slider.dart

This reference is generated from the Slider declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI