Flutter SDK offers two sets of styling widgets, the Material, and Cupertino Widget. The Material widget implements material design language for iOS, Android, web, and desktop applications. The Cupertino widget on the other hand is used to implement the current iOS design language based on Apple’s human interface guidelines.
So, here arises a question, why do we need a Cupertino widget for iOS app development when there is a Material widget that can be used for any platform including iOS.
Continue reading this article to know more about the Flutter Cupertino widget, why we need it, and how it helps you to build a beautiful cross-platform Flutter app that looks and feels like a native application.
The widget is specifically designed for the apps that run on the iOS platform. As the widget respects Android and iOS platform differences, it doesn’t support all the features in the Material widgets. Also, there are some licensing issues.
For example, if you run the Cupertino app on the Android platform you might not see the correct fonts loaded on the UI belonging to the San Francisco font family. Also, you may experience the pages getting dismissible via a back swipe.
Here are some basic things you need to know before using the Cupertino widget in the Flutter app.
Google introduced Material Design to work with any platform and not just Android. So, when you develop an app in Flutter with the Material widget, it doesn’t mean it will automatically get designed into the respective platforms.
It's a developer's responsibility to check the platform and design its components according to the platform standards. You can check whether the platform is Android or iOS using different conditions, such as:
However there is another sophisticated way i.e flutter_platform widgets, it simplifies the use of both Material and Cupertino widgets with a single widget.
First, install the plugin with flutter pub add flutter_platform_widgets . Then you need to create a base application using the PlatformProvider and PltformApp .
Then you can extend the app and utilize different platform widgets for building cross-platform apps with a simplified codebase.
In the sample code you can clearly see how we can render the material widget in the material context and the Cupertino widget in the Cupertino context using the PlatformProvider and the PlatformApp.
There are many other widgets under the Flutter Platform Widgets that help you to build a cross-platform app for Android and iOS that looks more native to the platforms.
So, now you know how you can achieve personalized results in the cross-platform application using the material and Cupertino widget.
DhiWise is the ProCode app development platform that aims to accelerate the process of software development by eliminating the grunt tasks. The platform provides the best features necessary to make the development process more efficient and error-free.
So, if you want to build a cross-platform application with Flutter try using DhiWise Flutter Builder. Here are its best features:
Also, read our article on Why to choose DhiWise for Flutter application development.
Well, besides all these it provides support for other Frontend and backend technologies, enabling full-stack application development using the single platform.