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

Publié le: 20 mai 2021
sur la chaîne: Flutter Mentor
669
16

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    • Mitsubachi – Smith The Mister (No Copyrigh...  


Sur cette page du site, vous pouvez voir la vidéo en ligne Flutter - Show Content/Elements According To Platform (Operating System) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Flutter Mentor 20 mai 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 669 fois et il a aimé 16 téléspectateurs. Bon visionnage!