Would anyone know how to create an age range slider in flutter? A slider which will have two input values. Somewhat like what Tinder has to choose min and max age. a slider that has two input fieldss
As I also needed this widget for one of my developments, I decided to develop it.
Here is the outcome
Source code my be found on GitHub
Full explanation on this link
What you are looking for is the Slider widget. I think a discrete slider would work best for what you are trying to achieve.
You should take a look at the Flutter Gallery App which has examples of many widgets along with source code which can be found on their GitHub repo.
Looking at their code from their Slider Demo, I have found this example which may suit your need:
new Slider(
value: _discreteValue,
min: 0.0,
max: 100.0,
divisions: 5,
label: '${_discreteValue.round()}',
onChanged: (double value) {
setState(() {
_discreteValue = value;
});
},
),
const Text('Discrete'),
],
)
Of course you will need to adjust this code to better suit your needs, but hopefully it gets you started in the right direction.
Let me know if you have any questions!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With