Will Cupertino widgets works on android

8.9k Views Asked by At

I have an issue where I need to use tab navigation. The current material scaffold only has 1 stack. So, if I need to go several levels deep (child pages), then I lose the tab context. The Cupertino scaffold allows me to go several levels deep but still maintain the root tabs.

If I change to the Cupertino scaffold, would I need to write two sets of code? Cupertino for iOS and Material for Android or is it converted to Flutter native code?

4

There are 4 best solutions below

0
On BEST ANSWER

No. you don't need to write twice. Cupertino widgets works completely fine on android.

3
On

There is a warning on Google Codelab

You can technically run a Cupertino app on either Android or iOS, but (due to licensing issues) Cupertino won't have the correct fonts on Android. For this reason, use an iOS-specific device when writing a Cupertino app.

0
On

Cupertino widgets and Material widgets are all built using the same underlying framework. Flutter is more like a game framework in that it builds all the UI itself with the Skia engine. This means that every widget built in flutter will work/look the same on every platform that Flutter is supported on (which will eventually include desktop, web and embedded systems as well). That's what makes Flutter so unique when compared to something like React Native that uses a bridge to create actual native components.

0
On

Well, functionality wise it will work. As you can see here, the code was written using CupertinoScaffold as the root widget and the theme for the app running on Android is just like an iOS app. All Scaffold does is manage how things are organized on the screen and some internal functionality, so whether you use an iOS theme or Android theme, that is totally upto you.

Now from a UI perspective, if you render an iOS like app to an Android app then your Android users might be flustered since the look and feel is not native to the platform.