circular_slider 0.0.1 copy "circular_slider: ^0.0.1" to clipboard
circular_slider: ^0.0.1 copied to clipboard

A customizable circular slider for Flutter.

Circular Slider #

GitHub License Pub Version

Preview #

[]

[Preview 1] [Preview 2]

Getting started #

Installation #

Add

dependencies:
  circular_slider: ^1.0.0
copied to clipboard

to your pubspec.yaml, and run

flutter packages get
copied to clipboard

in your project's root directory.

Usage #

Here is a basic usage of the widget:

CircularSlider(
  startAngle: 0.0, // from 0 to 2π, greater than endAngle
  endAngle: 3.141, // from 0 to 2π, less than startAngle
  strokeWidth: 24.0, // width of the track

  // required
  radius: 160,
  value: _value, // a value from 0.0 to 1.0
  knobBuilder: (context, angle) {
    return const Card(
      color: Colors.blue,
      shape: CircleBorder(),
    );
  },
  onChanged: (value) {
    // value obtained will always be between 0.0 and 1.0
    setState(() {
      _value = value;
    });
  },
)
copied to clipboard

The above implementation will look like this:

[Basic Usage]

Segments, Markers and Notches #

CircularSlider also provides these 3 parameter:

Parameter DataType
segments List<CircularSliderSegment>?
markers List<CircularSliderMarker>?
notchGroups List<CircularSliderNotchGroup>?

These allow you to customize your CircularSlider to be more informative to the user.

CircularSliderSegment

Segments can help you display different value ranges on your Slider.

Parameter DataType Description
color Color Color of the segment
start double value from 0.0 to 1.0
length double length of the segment proportional to the length of the Slider
width double Width of the segment

CircularSliderMarker

Markers help indicate a position on your Slider. You can use an Icon or any other Widget. Use [lockRotation] to make the marker follow the Slider's path.

Parameter DataType Description
marker Widget
size Size
lockRotation bool Locks the marker rotation to the center of the Slider circle
stepIndex double? The index of the Slider step where the marker will be positioned. To use this, value must be null.
value double? The value where the marker should be positioned. To use this, stepIndex must be null.

CircularSliderNotchGroup

Notches are minimalistic indicators for you Slider.

This depends on the value of [CircularSlider.steps] parameter if you use [stepIndex] your notches.

Parameter DataType Description
notches List List of CircularSliderNotch
spacing double
stepIndex double? The index of the Slider step. To use this, value must be null.
value double? The value where this group should be positioned. To use this, stepIndex must be null.

CircularSliderNotch

Parameter DataType Description
radius double The radius of the notch circle/dot
color Color The notch's color
filled bool Whether the notch dot should be filled or outlined
strokeWidth double Width of the outline.
7
likes
0
points
92
downloads

Publisher

verified publishernikhilbawane.com

Weekly Downloads

2024.09.13 - 2025.03.28

A customizable circular slider for Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on circular_slider