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

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

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.

Related

Advanced features with Flutter Driver (or Silenium/Ghost Inspector)

Looking for a UI integration test strategy for Flutter. We'd love to use Silenium/Ghost Inspector but seems that is not practical due to lack of html id's or CSS classes in Flutter (Add id or name property or other means of identification for Flutter Web applications?). Or has anyone found a way round that?
In the meantime Flutter Driver has only very basic documentation for simple tests like finding a button and pressing the button. Anyone know if I can do other operations like navigate to a specific page (e.g. using a # url fragment), test a link which leads to an external site, check visual setup of the page against an image, and other such tests which would be standard in Silenium and the like.
Thanks!!
Well seems Flutter Driver is still very limited so I have instead found a strategy for using Selenium, posted full details here:
Strategy to use Selenium browser testing with Flutter Web apps

How to generate and use a preview of a UI5 view

On a start page I have to offer the most recent editeded versions for quick access. I have the requirement that the user not only sees the name of the document but also a mini-preview. In fact, these documents are always the same object view but with different data bound.
So I guess the question is: Is there a simple way to include a shrunk version of a view in a view?
The easiest would be to convert the rendered HTML to canvas, and display that. Google uses a similar technique for generating website previews.
There are various html2canvas script which you can use, for instance https://github.com/niklasvh/html2canvas

OwnCloud enhance core features with App (eg. user registration)

I started looking into OwnCloud app development to add some capabilities I would like to my server. To me it seems like Apps can't modify anything like the Login page or User Management page. Is this the case?
I want to build a user registration app and would love to integrate it into the user management page (if not and it has to exist as its own app page not a big deal). The one big problem I see so far is not being able to add a "Register" link to the login page. I could just go in and add it to the source manually, but I would like to keep the App self contained so others can use it too.
If this is not possible to do in an App I may just need to modify the core application and then see if they will accept my feature addition in a pull request.
Thanks to anyone who can shed some light on this for me. I don't want to waste my time trying to figure out how to do it with an App on the platform if it wont be doable.
After a lot of digging around I did figure out a way to do this.
In the App's app.php file, you can force a script to be loaded if the plugin is enabled:
$api->addScript('script_name'); // without .js
In that script jQuery can be used to add the elements to the page where you need them.
This was a good solution for me since I only needed to add a single button to the login page. I can see this being a bad idea if you want to make vast modifications. At that point you might as well just create a separate page that you have full control over.

reloading the soundcloud html widget with different sets from links

I was advised to post this here by SoundCloud support - I hope you can help. I want to use the html5 widget on my site and access different sets but, rather than have multiple widgets on a page, I want to be able to reload the widget with a different set by clicking on different links on the page. It seems you can do this using the API and I have been playing with w.soundcloud.com/player/api_playground.html and have got it to load my sets by putting the api.soundclound.com url in the appropriate box and clicking "reload widget".
I really don’t know javascript at all so I was hoping to copy the source from that page and try and edit it to do what I want. However, I can’t even get the page to load when it is hosted on my site:
http://www.indigomusic.co.uk/SCtest/playground.htm
I downloaded api.js and put it in a folder on my server but I’m obviously missing step(s). I’ve read http://developers.soundcloud.com/docs/html5-widget#introduction but it obviously assumes a level of javascript knowledge that I just don’t have...
...are you able to help?
Many thanks,
Dan Selby
You don't have do use the Widget API for that necessarily.
Here is a simple example using jQuery and the SoundCloud SDK doing what you described:
http://dl.dropbox.com/u/12477597/Temporary/dynamic-widget-example.html
Hope it Helps.

How to create custom pages in dasBlog?

I know I've seen this in the past, but I can't seem to find it now.
Basically I want to create a page that I can host on a dasBlog instance that contains the layout from my theme, but the content of the page I control.
Ideally the content is a user control or ASPX that I write. Anybody know how I can accomplish this?
The easist way to do this is to "hijack" the FormatPage functionality.
First add the following to your web.config in the newtelligence.DasBlog.UrlMapper section:
<add matchExpression="(?<basedir>.*?)/Static\.aspx\?=(?<value>.+)" mapTo="{basedir}/FormatPage.aspx?path=content/static/{value}.format.html" />
Now you can create a directory in your content directory called static. From there, you can create html files and the file name will map to the url like this:
http://BASEURL/Static.aspx?=FILENAME
will map to a file called:
/content/static/FILENAME.format.html
You can place anything in that file that you would normally place in itemTemplate.blogtemplate, except it obviously won't have any post data. But you can essentially use this to put other macros, and still have it use the hometemplate.blogtemplate to keep the rest of your theme wrapped around the page.
I did something similar setting up a handler to stream video files from the blog on my home server. I ended up ditching it because it killed my bandwidth whenever someone would view a video, but I did have it up and working for a while.
To get it to work I had to check dasBlog out from source control and open it in visual studio. I had VS2008 and it was built using VS2005, so it took some work to get everything to build. Once I could get the unaltered solution to build I added a new class library project to hold my code. This is to make sure my code stays separate across dasBlog updates.
I don't have access to the code here at work so I can't tell you exact names right now, but if you want your pages to be able to use the themes then they need to inherit from a class in the newtelligence.dasBlog.Web namespace, and I believe also implement an interface. A good place to look is in FormatPage and FormatControl.