Which is the better way to white-label a flutter app
Asked Answered
C

1

8

I have one project that I have to sell to another clients, so I wanna found a way to unify the code to, when I release some updates, I have to manipulate only one code (and, of course, keeping the specificities from each one)

I found an article HERE which the guy creates a new folder named 'config' and set some variables there to be used in the parent project. I tried this but find out that would be very tough to do because the first app was developed specifically by one client, and with it I would need so much time to make all the aspects dynamic... Another problem is firebase, in first app I used firebase but in the second i won't. How to make it possible?

And in this article they say about 'flavours' that can be used to do something similar.

Someone knows about this approaches or there is another to reach my goal? With flavours I will have less re-factor than with config?

I appreciate any help

Chaudoin answered 19/3, 2021 at 11:50 Comment(4)
Did you find the best way?Crapulent
I did it through flavorsChaudoin
@Chaudoin And are you satisfied with the result?Relevant
What about the identity of the brand, I mean the launcher icon, splash screen which may be generated by packages, and assets that are different in colors for each app? Additionally, in using flavors, you should duplicate files like the Android manifest and Firebase config, and the main file as well. Did you find a quick solution for all of that?Mehetabel
T
-1

A third way to do this with no client specific app configuration is to make an api call to get back your client specific theme, and then set the flutter theme based on this.

If you need web support see below:

First update your assets in index.html that aren't white labeled, leaving stubs in their place that we'll fill in later. i.e.

Next show a nice loading indicator while flutter loads. To do this, just put the html for it in the body element of the index.html file.

Finally update the webpage title and favicon using javascript inside Flutter. I used package

universal_html: 2.0.8
https://pub.dev/packages/universal_html then you can update the favicon

import 'package:universal_html/html.dart';

var favicon = document.getElementById('favicon'); favicon?.setAttribute('href','insertLinkToYourImage'); Updating the title can be accomplished in various normal ways like just setting the title attribute of a MaterialApp widget.

Tailband answered 11/7, 2022 at 18:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.