If you’re doing a hybrid app, then you’re VERY likely going to need to know how to present your UI’s content or elements depending on what platform the user is.

One common example is the Slider style. iOS has a native look and feel that is very specific to their devices (CupertinoSlider widget), while Android is allowed a bit more freedom (but still, it’s always a good idea to follow material design - Slider widget).

However, the Slider widget already comes with the “Slider.adaptive” option that alternates its look according to the user’s operating system.

But how do you go about with other widgets or even your very own custom widgets?

It’s actually super simple. Just watch this short Flutter video tutorial and you’ll exactly how to do it very quickly and easily.

You just have to find out what platform the user is on (through Platform.isIOS or Platform.isAndroid) and then display your elements according to that information.

00:00 - Intro
00:30 - Import dart:io
00:52 - Conditional Method 1 (If Statement)
02:13 - Conditional Method 2 (Ternary Operator)
03:21 - Like & Subscribe
03:30 - Flutter Mentor Out

#flutter #operatingsystem #platform

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 #operatingsystem #platform

Show Content/Elements According To Platform (Operating System) - Flutter
1.25 GEEK