CupertinoSlider — All Cupertino Widgets

Tomic Riedel
2 min readNov 24, 2022

--

In this series, we look at the whole Cupertino package of Flutter. You will get to know every widget, important classes, and much more in this series. All the articles will be less than 2 minutes long, so you can read them every time :) In addition to that, they will be very easy to understand, following the motto

Make everything as simple as possible, but not simpler. ~ Albert Einstein

If you want to check out the other articles of this series, check out this list. Let’s get started!

Happy reading!

CupertinoSlider

CupertinoSlider is an iOS-styled slider, who would have thought it ;)

Okay, so let’s take a look at it:

First, we want to discuss the values that the user can choose from. There is the min and max property, both of type double, that determine the minimum and maximum value of the slider. There is also division, so the number of discrete divisions. Let’s say your min value is 0, your max value is 10, and your division is set to 5. Then the user can select 0, 2, 4, 6, 8, or 10, because there now there are 5 options (minimum value doesn’t count) to choose from.

The call different functions or something else if the user starts selecting a value ends selecting a value, or has selected a value, use onChangeStart, onChangeEnd and onChanged. The valueproperty represents the currently selected value.

Lastly, let’s customize our slider a bit. We can set the color for the portion of the slider that has been selected with activeColor and the thumb color with thumbColor. Great, this was everything that we need to know about CupertinoSlider. Let’s take a look at an example:

Further reading & Conclusion

In this article, you have learned how to use the CupertinoSlider.

Did you know that there are great packages that enhance your development enormously? For example Freezed, Isar, or Flutter Hooks. If you want to learn about these great packages, I have entire tutorials about them. Check them out here.

In the following few articles, I will introduce more Cupertino widgets, essential classes, and more stuff. If you don’t want to miss this, I recommend you follow me!

Thanks for reading, have a nice day!

--

--

Tomic Riedel

Sharing the process of building a portfolio of apps to make people more productive.