Reputation: 129
I am looking to move from using Phonegap to using Flutter and currently, I have an app that can be themed multiple times from one project and deployed to IOS/Android stores
I know flutter has a theme class to be used across an app but I am looking to dynamically set this based on the app that is being used for example
Name: App A
Colors: red, blue, green
Name: App B
Colors: yellow, orange, purple
Both apps use the same code base and pages but are deployed as individual apps to the app stores
Is there an easy way to do this using flutter or would I need to create a new project for every new app that is created?
Upvotes: 5
Views: 3938
Reputation: 10161
You can create the multiple flavors
In android you can add a flavors in android/app/build.gradle
flavorDimensions "free"
productFlavors {
free {
dimension "app"
applicationId "com.example.free"
versionCode 1
versionName "1.0"
}
paid {
dimension "app"
applicationId "com.example.paid"
versionCode 1
versionName "1.0"
}
}
and for iOS
You can use the iOS Schema
.
Below doc can help you in this:
https://flutter.dev/docs/deployment/flavors
Upvotes: 2
Reputation: 15751
yes, you need to use flavors, and for each flavor you should specify its own theme. Each flavor will have its own main
. Using flavors with different application id allow you to upload distinct apps on the store with same code base.
Read more about flutter flavors here
Upvotes: 0