BaseSlider class
BaseSlider - Cross-platform slider with native iOS support
Uses CNSlider (Cupertino Native) for iOS - provides true native iOS appearance with built-in liquid glass effects and native rendering. Uses Material Slider for Android and other platforms.
*** use cupertino = { forceUseMaterial: true } force use Material Slider on iOS *** use material = { forceUseCupertino: true } force use CNSlider on Android
Features:
- Native iOS slider via CNSlider (cupertino_native package)
- Material Design slider for Android
- Consistent API across platforms
- Built-in liquid glass effects on iOS (no manual wrapper needed)
- Discrete divisions and labels (Material only)
Example:
BaseSlider(
value: _sliderValue,
min: 0,
max: 100,
onChanged: (v) => setState(() => _sliderValue = v),
)
Updated: 2024.10.25 - Integrated CNSlider for native iOS rendering
- Inheritance
Constructors
-
BaseSlider({Key? key, double? value, ValueChanged<
double> ? onChanged, ValueChanged<double> ? onChangeStart, ValueChanged<double> ? onChangeEnd, double min = 0.0, double max = 1.0, int? divisions, Color? activeColor, Color thumbColor = Colors.white, String? label, Color? inactiveColor, MouseCursor? mouseCursor, FocusNode? focusNode, bool autofocus = false, SemanticFormatterCallback? semanticFormatterCallback, BaseParam? baseParam}) -
const
Properties
- activeColor → Color?
-
CupertinoSlider.activeColor
or
Slider.activeColor
final
- autofocus → bool
-
Slider.autofocus
final
- baseParam → BaseParam?
-
Personalization parameters, gets platform parameters first, then mode parameters
finalinherited
- divisions → int?
-
CupertinoSlider.divisions
or
Slider.divisions
final
- focusNode → FocusNode?
-
Slider.focusNode
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inactiveColor → Color?
-
Slider.inactiveColor
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
*** cupertino properties end ***
*** material properties start ***
Slider.label
final
- max → double
-
CupertinoSlider.max
or
Slider.max
final
- min → double
-
CupertinoSlider.min
or
Slider.min
final
- mouseCursor → MouseCursor?
-
Slider.mouseCursor
final
-
onChanged
→ ValueChanged<
double> ? -
CupertinoSlider.onChanged
or
Slider.onChanged
final
-
onChangeEnd
→ ValueChanged<
double> ? -
CupertinoSlider.onChangeEnd
or
Slider.onChangeEnd
final
-
onChangeStart
→ ValueChanged<
double> ? -
CupertinoSlider.onChangeStart
or
Slider.onChangeStart
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticFormatterCallback → SemanticFormatterCallback?
-
Slider.semanticFormatterCallback
final
- thumbColor → Color
-
*** general properties end ***
*** cupertino properties start ***
CupertinoSlider.thumbColor
final
- value → double?
-
*** general properties end ***
CupertinoSlider.value
or
Slider.value
final
Methods
-
beforeBuild(
BuildContext context) → void -
Called before build
inherited
-
beforeBuildByCupertino(
BuildContext context) → void -
Called before buildByCupertino
inherited
-
beforeBuildByCupertinoNative(
BuildContext context) → void -
Called before buildByCupertinoNative (native iOS implementation)
inherited
-
beforeBuildByMaterial(
BuildContext context) → void -
Called before buildByMaterial
inherited
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
buildByCupertino(
BuildContext context) → Widget - *** material properties end ***
-
buildByCupertinoNative(
BuildContext context) → dynamic -
build on cupertino mode with native iOS components (cupertino_native package)
This is called when baseParam.nativeIOS = true
Default implementation falls back to buildByCupertino()
inherited
-
buildByMaterial(
BuildContext context) → Widget - build on material mode
-
commonBuild(
BuildContext context, BaseParam? baseParam) → dynamic -
inherited
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
-
getBuildMode(
BaseParam? baseParam) → WidgetBuildMode -
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
-
valueOf(
String key, dynamic value) → dynamic -
inherited
-
valueOfBaseParam(
BaseParam? baseParam, String key, dynamic value) → dynamic -
No reflection available in Dart
First get value from platform, then from mode, finally from value itself
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited