Skip to content

Support different set of assets depending on platform and flavor parameters.

License

Notifications You must be signed in to change notification settings

sestegra/flutter_assets_flavors

Repository files navigation

flutter_assets_flavors

This application supports different set of assets and launcher icons depending on platform and flavor parameters.

X Y Z
Android Android Android X Android Y Android Z
iOS iOS iOS X iOS Y iOS Z

Assets manifest files

Manifest files are loaded in following order

  • pubspec.yaml
  • assets.yaml
  • assets-<platform>.yaml
  • assets-<flavor>.yaml (only for local package)
  • assets-<platform>-<flavor>.yaml (only for local package)

assets, fonts and use-material-design parameters are overridden at each loaded file.

When an assets file is not present, the next one is loaded without overriding parameters from previous steps.

Assets file format is the same as pubspec.yaml.

Launcher icons manifest files

Note that following pull request is required Read flavor icons files.

Manifest files are flutter_launcher-<flavor>.yaml (see Flutter Launcher Icons)

Launch following command to prepare flavored launcher icons.

$ flutter packages pub run flutter_launcher_icons:main

Getting Started

In order to enable different set of assets, Flutter should be patched until pull request (https://github.com/flutter/flutter/pull/25487/files) will be merged.

Launch following command (only support Flutter 1.0.0 for now).

$ flutter-patch $(pwd) 1.0.0

Optionaly, you could use flutter-flavor command tool to manage flavors in your Flutter app. See https://github.com/sestegra/flutter-flavor repository.

Run/Build

This project contains a Makefile that runs and builds flavored launcher icons and all flavored applications.

For running applications, launch following commands:

$ plutil -replace CFBundleIdentifier -string <base bundle id>.<flavor> ios/Runner/Info.plist # Workaround for issue #21335
$ flutter run --flavor <flavor> --target lib/main_<flavor>.dart

For building application, launch following commands:

$ flutter build apk --flavor <flavor> --target lib/main_<flavor>.dart
$ flutter build ios --flavor <flavor> --target lib/main_<flavor>.dart

Opened issues/pull requests

Flutter

Flutter Launcher Icons

About

Support different set of assets depending on platform and flavor parameters.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published