Slider
A draggable slider component for selecting values within a range
A draggable slider component for selecting values within a continuous range.
When to use this
- Volume controls: Adjust audio or video volume levels
- Brightness settings: Control screen brightness or lighting
- Price filters: Select price ranges in e-commerce applications
- Value adjustments: Set any numeric value within a defined range
Basic implementation
Basic implementation
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class SliderExample extends StatefulWidget {
const SliderExample({super.key});
@override
State<SliderExample> createState() => _SliderExampleState();
}
class _SliderExampleState extends State<SliderExample> {
double _selectedValue = 0.3;
@override
Widget build(BuildContext context) {
return SizedBox(
width: 300,
child: RemixSlider(
value: _selectedValue,
style: style,
onChanged: (value) {
setState(() {
_selectedValue = value;
});
},
),
);
}
RemixSliderStyle get style {
return RemixSliderStyle()
.thumbSize(const Size(24, 24))
.thumb(
BoxStyler().shapeCircle().shadow(
BoxShadowMix()
.color(Colors.black45)
.blurRadius(4)
.offset(const Offset(0, 2)),
),
)
.thumbColor(Colors.black)
.thickness(2)
.trackColor(Colors.grey.shade300)
.rangeColor(Colors.black)
.onDisabled(
RemixSliderStyle()
.trackColor(Colors.grey.shade300)
.rangeColor(Colors.blueGrey)
.thumbColor(Colors.white.withValues(alpha: 0.6)),
);
}
}
Fortal styles
Remix includes Fortal-themed style helpers for this component:
Fortal variants
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class FortalSliderExample extends StatefulWidget {
const FortalSliderExample({super.key});
@override
State<FortalSliderExample> createState() => _FortalSliderExampleState();
}
class _FortalSliderExampleState extends State<FortalSliderExample> {
double _value = 0.5;
@override
Widget build(BuildContext context) {
return Column(
spacing: 16,
children: [
RemixSlider(
value: _value,
onChanged: (v) => setState(() => _value = v),
style: FortalSliderStyle.solid(),
),
RemixSlider(
value: _value,
onChanged: (v) => setState(() => _value = v),
style: FortalSliderStyle.soft(),
),
],
);
}
}
See the FortalSliderStyle source code for all available options.
Constructor
Constructor
const RemixSlider({
Key? key,
required double value,
required ValueChanged<double>? onChanged,
ValueChanged<double>? onChangeStart,
ValueChanged<double>? onChangeEnd,
double min = 0.0,
double max = 1.0,
bool enabled = true,
bool enableHapticFeedback = true,
FocusNode? focusNode,
bool autofocus = false,
int? snapDivisions,
RemixSliderStyle style = const RemixSliderStyle.create(),
RemixSliderSpec? styleSpec,
})
enableHapticFeedback → bool
Optional. Whether to provide haptic feedback during value changes. Defaults to true.
autofocus → bool
Optional. Whether the slider should automatically request focus when it is created.
snapDivisions → int?
Optional. Optional snapping divisions for interaction only (no visual ticks). When provided, the slider snaps to these discrete steps but does not render any division marks on the track.
foregroundDecoration(DecorationMix value)
Sets a foreground decoration painted on top of the component.

