If you want to know how to easily implement a regular slider into your apps, you can find out in this video.

Flutter makes it all very convenient and easy to implement. All you have to do is define a minimum (min) and maximum (max) so that the slider has a minimum and a maximum value to work with.

After that, you need to create a variable of type double to apply it to the “value” property. This is the property that will always store the slider’s current value every time it’s changed.

Now all you have to do is add an anonymous function to the onChanged property. The anonymous function carries the changed value as its argument and you can apply it to the variable previously created for the “value” property. This way, the value is always updated.

But don’t forget to use setState otherwise nothing will change in the UI!

That’s it. You have a working slider!

Finally, you can add divisions and a label but it’s optional really. I go over all of this in the video.

If you’d like to know how to have full control over the styling of the slider, then you’re in luck because that’s the topic of the next Flutter video tutorial!

Thanks for watching.

Slider Widget Official Documentation: https://api.flutter.dev/flutter/material/Slider-class.html
Also forgot to mention Slider.adaptive (a version that adapts the slider style according to Android style and iOS style - it works the same though) Documentation: https://api.flutter.dev/flutter/material/Slider/Slider.adaptive.html

00:00 - Intro
00:41 - Adding The Slider Widget
00:57 - onChanged Property
01:15 - value Property
01:55 - Making The Slider Work In The UI
03:07 - divisions Property
04:04 - label Property
04:39 - How To Style Video To Be Uploaded Next
05:00 - Like & Subscribe
05:05 - Flutter Mentor Out

#flutter #slider #widget

Credits:

OUTRO SONG:
Mitsubachi by Smith The Mister https://smiththemister.bandcamp.com
Smith The Mister https://bit.ly/Smith-The-Mister-YT
Free Download / Stream: http://bit.ly/mitsubachi
Music promoted by Audio Library https://youtu.be/0IgndUb1YQI

#flutter #slider #widget

How The Slider Widget Works - Flutter
1.85 GEEK