Flutter different designs for Android and IOS

643

Solution 1

Checkout: https://pub.dev/packages/flutter_platform_widgets

Its a library that has already done this for a bunch of widgets. If the library doesn't have something you want you can make use of the PlatformWidget from the library. Under the hood it will be doing something similar to fartem's answer.

Solution 2

You can build widgets tree with platform separation or move your widgets to a separated classes/files. Example:

Example with just if:

if (Platform.isAndroid) {
  return Column(
    // Android specific layout
  );
} else {
  return Column(
    // iOS specific layout
  );
}
Share:
643
isi_ko
Author by

isi_ko

Updated on December 27, 2022

Comments

  • isi_ko
    isi_ko over 1 year

    I am currently developing an app that I want to release for Android and IOS. My problem is that I don't want to use Material Design for both platforms, as that wouldn't match the IOS design language. Is there any way to use one codebase and compile it for Android using Material Design and for IOS using Cupertino? If not, what is the usual way to go?

  • isi_ko
    isi_ko over 3 years
    Ok, but wouldn't that be bad for Performence, because I would have unused Code in my App, that is only used for the other Platform?