gradient_circular_slider 1.0.1
gradient_circular_slider: ^1.0.1 copied to clipboard
A beautiful and customizable circular slider widget with gradient progress, draggable knob, auto-fitting text display, and circular arc labels for Flutter apps.
Gradient Circular Slider #
A beautiful and customizable circular slider widget with gradient progress for Flutter applications. Perfect for creating intuitive and visually appealing value selectors with smooth animations and haptic feedback.
Screeshot #
[Screenshot of Gradient Circular Slider]Features #
β¨ Beautiful Gradient Progress - Smooth color transitions with customizable gradients
π― Draggable Knob - Interactive knob with shadow/glow effects that follows the circular path
β¨οΈ Tap-to-Edit Input - Tap the center text to type an exact value with validation and clamping
π§ Controller Support - Use GradientCircularSliderController to dismiss edit mode programmatically
π€ Dual Arc Labels - Optional outer and inner curved labels that hug the ring perfectly
π³ Haptic Feedback - Tactile feedback during interaction (configurable)
π Initial Sweep Animation - Optionally animate the first sweep after layout for delight
π Smart Size/Position Animation - Widget lifts toward the top and eases out while editing
π¨ Fully Customizable - Colors, sizes, styles, shadows, and behaviors are all configurable
Installation #
Add gradient_circular_slider to your pubspec.yaml:
dependencies:
gradient_circular_slider: ^1.0.0
Then run:
flutter pub get
Usage #
Basic Example #
import 'package:gradient_circular_slider/gradient_circular_slider.dart';
GradientCircularSlider(
minValue: 0,
maxValue: 100,
initialValue: 50,
gradientColors: [Colors.blue, Colors.green],
onChanged: (value) {
print('Value: $value');
},
)
Advanced Example with Custom Styling #
final sliderController = GradientCircularSliderController();
GradientCircularSlider(
controller: sliderController,
minValue: 0,
maxValue: 101.99,
initialValue: 101.34,
gradientColors: const [
Color(0xFFFFD700),
Color(0xFFFF6B6B),
Color(0xFF4ECDC4),
],
initialSweepAnimationDuration: const Duration(milliseconds: 500),
labelText: "TAP TO ENTER AMOUNT VALUE",
labelStyle: TextStyle(
color: Colors.amber.withAlpha(153),
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: 2,
),
innerLabelText: "DRAG OR TAP TO EDIT",
innerLabelStyle: TextStyle(
color: Colors.white.withAlpha(128),
fontSize: 10,
fontWeight: FontWeight.normal,
letterSpacing: 2.5,
),
prefix: "βΉ",
prefixScale: 0.5,
decimalPrecision: 2,
ringThickness: 27,
knobRadius: 16,
textColor: Colors.amber,
ringBackgroundColor: Colors.grey.shade800,
knobColor: Colors.amber,
enableHaptics: false,
knobShadows: const [
BoxShadow(
color: Color.fromARGB(112, 0, 0, 0),
blurRadius: 5,
spreadRadius: 3,
),
],
onChanged: (val) => debugPrint("Value: $val"),
onChangeStart: () => debugPrint("Started dragging"),
onChangeEnd: () => debugPrint("Stopped dragging"),
)
Edit Mode & Controller #
Tap the value inside the ring to enter edit mode. The circle scales up, slides toward the top, and the numeric text field becomes interactive (with optional prefixes, decimals, and validation).
Use the optional GradientCircularSliderController to dismiss edit mode programmatically (for example when navigating away or tapping outside the widget).
final sliderController = GradientCircularSliderController();
GradientCircularSlider(
controller: sliderController,
initialValue: 42,
// ...other options
);
// Dismiss edit mode from anywhere in your widget tree
sliderController.dismiss();
Customization Options #
| Parameter | Type | Description | Default |
|---|---|---|---|
controller |
GradientCircularSliderController? |
Provides dismiss() to exit edit mode programmatically |
null |
minValue |
double |
Minimum slider value | 0 |
maxValue |
double |
Maximum slider value | 120 |
initialValue |
double |
Starting value inside the ring (required) | β |
initialSweepAnimationDuration |
Duration |
Adds a delayed sweep animation after layout | Duration.zero |
gradientColors |
List<Color> |
Colors for the circular gradient (min 2) | [Colors.lightBlueAccent, Colors.blue] |
ringThickness |
double |
Width of the circular ring | 20.0 |
ringBackgroundColor |
Color? |
Background/track color of the ring | Colors.grey.withAlpha(51) |
prefix |
String |
Symbol before the value (e.g. $, βΉ, %) |
'$' |
prefixScale |
double |
Ratio of prefix font size to value font (0β1) | 0.6 |
textColor |
Color |
Color for the center value while not editing | Colors.white |
decimalPrecision |
int |
Digits after the decimal point | 2 |
labelText |
String? |
Optional curved label along the top of the ring | null |
labelStyle |
TextStyle? |
Style for the outer curved label | null |
innerLabelText |
String? |
Optional curved label along the inner ring | null |
innerLabelStyle |
TextStyle? |
Style for the inner curved label | null |
enableHaptics |
bool |
Enables light/medium haptic feedback while dragging | true |
knobRadius |
double |
Size of the draggable knob | 15 |
knobColor |
Color? |
Color of the knob fill | Colors.white |
knobShadows |
List<BoxShadow>? |
Custom drop shadows for the knob | Gentle default glow |
animationDuration |
Duration |
Duration for value interpolation when animating | 500ms |
animationCurve |
Curve |
Curve for value interpolation | Curves.easeInOut |
Callbacks #
| Callback | Type | Description |
|---|---|---|
onChanged |
ValueChanged<double>? |
Called when the value changes |
onChangeStart |
VoidCallback? |
Called when dragging starts |
onChangeEnd |
VoidCallback? |
Called when dragging ends |
Examples #
Currency Selector #
GradientCircularSlider(
minValue: 0,
maxValue: 10000,
initialValue: 5000,
gradientColors: [Colors.green, Colors.blue],
prefix: "\$",
labelText: "SELECT AMOUNT",
)
Percentage Slider #
GradientCircularSlider(
minValue: 0,
maxValue: 100,
initialValue: 75,
gradientColors: [Colors.red, Colors.orange, Colors.yellow],
prefix: "%",
decimalPrecision: 0,
labelText: "COMPLETION",
)
Temperature Control #
GradientCircularSlider(
minValue: 16,
maxValue: 30,
initialValue: 22,
gradientColors: [Colors.blue, Colors.red],
prefix: "Β°",
decimalPrecision: 1,
labelText: "TEMPERATURE",
)
Performance #
The widget is optimized for smooth 60fps performance on all modern devices:
- Efficient rebuilds with only necessary repaints
- Hardware-accelerated rendering
- Optimized gesture detection
- Smooth animations with customizable curves
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Author #
Created with β€οΈ by Bharath Bandaru
Support #
If you find this package helpful, please consider giving it a β on GitHub!