davidanaya / flutter-circular-slider Goto Github PK
View Code? Open in Web Editor NEWA customizable circular slider for Flutter.
Home Page: https://pub.dartlang.org/packages/flutter_circular_slider
License: MIT License
A customizable circular slider for Flutter.
Home Page: https://pub.dartlang.org/packages/flutter_circular_slider
License: MIT License
Nice to meet you. I am new to Dart and want to make good use of this library.
There is one thing I want to ask.
Although onSelectionEnd
is commented that its definition takes a function with a parameter of (int init, int end) as an argument, it is actually a function that takes three parameters.
I would like you to teach me the role of each parameter. Thank you.
Center(
child: SingleCircularSlider(
12,
3,
handlerColor: Colors.black,
onSelectionEnd: (a, b, c) {
// I do not figure out what a, b, c parameters mean.
},
baseColor: Colors.grey.withOpacity(0.5),
selectionColor: Colors.deepPurple,
),
),
DoubleCircularSlider(
48,
0,
10,
height: 230.0,
width: 230.0,
primarySectors: 4,
secondarySectors: 12,
baseColor: Color.fromRGBO(255, 255, 255, 0.1),
selectionColor: Theme.of(context).primaryColor,
handlerColor: Color(0xFFEEEEEE),
onSelectionChange: (int initTime, int endTime, int laps) {
setState(() {
this.initTime = initTime;
this.endTime = endTime;
});
},
child: Padding(
padding: const EdgeInsets.all(42.0),
child: Center(
child: Text('${_formatIntervalTime(initTime, endTime)}',
style: TextStyle(fontSize: 36.0, color: Colors.white))),
),
),
Hot reloading properly updates the state (updates the time)
Is there a way to prevent the user from increasing the slider? Eg. only being able to decrease it until 0? If yes, any tips how someone would do it?
I want that the drag happens from one side so always the init is 0 and you can't change it and only one circle to drag ?
Are there any plans to convert this library to null safety?
It would be useful for some use cases to allow making the SingleCircularSlider
selection direction be counter-clockwise.
Is there s way to customize sectors width, height and color?
Also - is there a way change appearance of handlers, like using your own widgets?
It's a must-have for any modern flutter library
Repro steps:
So essentially laps are completely broken too.
It would be nice to be able to specify using a dashed line for the base line.
The section lines can be more customizable and I wish for that right now
https://github.com/davidanaya/flutter-circular-slider/blob/master/lib/src/base_painter.dart#L37-L43
if (primarySectors > 0) {
_paintSectors(primarySectors, 8.0, selectionColor, canvas);
}
if (secondarySectors > 0) {
_paintSectors(secondarySectors, 6.0, baseColor, canvas);
}
the radiusPadding
can be made customizable and the secondarySector should not use the baseColor, but rather allow a custom one and default to baseColor
Any tip on how would you implement constraints like:
For example, if a use case would be selecting time range in a single day, there is no obvious way how to achieve this.
Thanks!
I want to make a design like speedOmeter with the handle and same dragging event like yours. Can you please help me to build that? Or suggest the way to build half circle?
Hi,
Great work on the sliders. Just a quick query, lets say there is only one handler, then instead of dragging, is it possible to click somewhere on the circle and the handler to move there. This is similar to how linear slider in flutter would work. Thanks!
In our case, the CircularSlider
is inside a SingleChildScrollView
and it seems that it gets all the gestures 99% of the times we try to drag.
Hello,
I am trying to use circular slider with many instances. I am creating different objects but every time the position does not change even though I am setting it with a different value.
Is it possible to use your widget with multiple instances?
Thanks.
能更新一下代码吗,
Hi David, great package! Can you please add the ability to set an initial lap value? I am using your slider to create values, lets say in increments of 200, and saving both the total value and the laps. If the value is 500, I would have laps = 2, and the slider would be at 50%. When I initialize the slider at another time, I want the slider to know that the lap count is 2...not 0. So when I decrement the slider it allows me to reset the value from 500 back to 0. Without a lap initialized, I cannot decrement back to 0. Thank you!
When I decide to change the value of selectionColor and handlerColor through a changenotifierProvider, the color does not change until I slightly move the slider.
in the article you wrote here
https://itnext.io/how-to-build-a-circular-slider-in-flutter-cab3fc5312df
how did you get the line to split the circle ?
is it possible to have only one hadler ( the thing that you drag ) ?
Many thanks
Great work !
The section lines can be more customizable and I wish for that right now
https://github.com/davidanaya/flutter-circular-slider/blob/master/lib/src/base_painter.dart#L37-L43
if (primarySectors > 0) {
_paintSectors(primarySectors, 8.0, selectionColor, canvas);
}
if (secondarySectors > 0) {
_paintSectors(secondarySectors, 6.0, baseColor, canvas);
}```
the `radiusPadding` can be made customizable and the secondarySector should not use the baseColor, but rather allow a custom one and default to baseColor
Hi, would be great to be able to use onSelectionChange to control/validate the values (thus enabling user logic like max interval size or similar...).
I need to change slider position not only by user interaction, but from code as well. My build()
function returns this widget:
FractionallySizedBox(
widthFactor: 0.5,
child: Container(
color: Colors.redAccent,
child: SingleCircularSlider(
255,
entity.brightness ?? 0
),
),
)
Changing the value of entity.brightness
and rebuilding the widget didn't change it's position.
So simply the bug happen when the start is at 0 and stays in 0 and you drag the end to 0 the slider disappear
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.