Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Flutter app styled as iOS on Android

Tags:

flutter

I have some widgets in my Flutter app which are styled differently between Android and iOS (where I have done this, I always used Theme.of(context).platform).

I'm using an old MacBook Air to build my iOS apps and did some screenshots using it, but they are too low res, so I want to redo these on my PC using an Android emulator.

I can adjust a few things and run the app styled as iOS on the Android emulator, but rather than adjusting my code, is there a command line parameter I can pass to tell it to run as an iOS device?

I just want the app to look like it would as if it is running on an iOS device for the purposes of taking some screenshots.

like image 703
Mulder Avatar asked Jan 13 '19 15:01

Mulder


People also ask

Can Flutter run on both iOS and Android?

Flutter is an open source framework developed by Google that lets you build natively compiled, multiplatform applications from a single codebase. Flutter 3 supports six platform targets: Android, iOS, Windows, macOS, Linux, and web applications.

How do I run a Flutter app on iOS real device?

You need to go to your Settings > General > Device Management. Inside Device Management, select the developer name and tap Trust “YOUR DEVELOPER NAME”. You should now be able to run your Flutter app on your local device.

How do I release the Flutter app for iOS and Android?

Add an app icon Review the iOS App Icon guidelines. In the Xcode project navigator, select Assets.xcassets in the Runner folder. Update the placeholder icons with your own app icons. Verify the icon has been replaced by running your app using flutter run .


1 Answers

You can use

MaterialApp(theme: ThemeData(platform: TargetPlatform.iOS),

or use Cupertino widgets https://flutter.io/docs/development/ui/widgets/cupertino

like image 86
Günter Zöchbauer Avatar answered Oct 28 '22 03:10

Günter Zöchbauer