How do I modify a library in flutter? - flutter

I'm using a library that draws barcodes and under them it drows the barcode number, however it draws text just in black color. I found the code that chooses the color during this operations, however when I try to change this code library from Colors.black to Colors.white and I save it, it doesn't save for some reason. So I suppose there is a different way to modify code from library, but I don't know how.

#Gabriel, You can easily copy .dart files from the package/library you're using to your project and modify the code to your liking. For e.g. if you are using https://pub.dev/packages/toggle_switch, then you can access the source code from the GitHub location of the package in pub.dev and download it from GitHub,
You can then copy .dart files from <project>/lib to your <project>/lib and modify them accordingly. Make sure you add reference in the source code to credit the original developers and add their GitHub link.
Good luck!

Related

How to identify that asset added inside Assets.xcassets are used in project?

How to identify quick way the Assets added inside Assets.xcassets for Images & color are using inside project or not.
Example:
int value = 10
In this case int value not used inside application which give an warning.
Initialization of immutable value 'value' was never used; consider replacing with assignment to '_' or removing it
What if inside Assets.xcassets added color or image are not used how to identify ?
Xcode has no tool which could highlight not used assets but there is a open source project called "AssetsChecker" which will do the job.
There's no way a tool can know which assets are not being used by your application.
Imagine that you are creating a Weather app, and the data you receive from the server includes the image_key that you use to know which asset to load.
If a tool to find unused assets was used, it would tell you that every image or color that is not referenced directly is not used, which would yield a LOT of false positives.

How to display GIF in app?

i am trying to load gif in my project as per my requirement to show animation,
i have used third-party lib for showing gif animation,
i have copied same code from demo project but not working in my project.
Here is my code :
let animatedGif = UIImage.gif(name: "loading")
As #Patrick suggested, you have to replace your image path from asset folder and move it in your app’s bundle. This issue is also raised in its official git library’s issue tab. https://github.com/bahlo/SwiftGif/issues/67.

Android drawable resources: how to change color scheme based on version of application

I am trying to implement two different versions of the same application, the only difference being the color scheme. How would I go about displaying different drawables based on the version?
For example, let's say I have a Blue version and a Red version. I would like to use the same source code for both but have an easy way to convert between the two color schemes. I am confused on how I would tell Android that I want to use the Blue version (or Red) and have it access files perhaps in resources/drawables/Blue or resources/drawables/Red. I found the link below, but I don't understand how I can implement this using just one package. Is it possible?
Dynamically change the name of the resource file to be used?
Making resources theme dependent
One way to do it is simply have a SharedPreferences int, where if it is 0, the app is in "red mode" and 1, it is in "blue mode". The downside of this is that you have to change the scheme in each activity.

JavaFX 2.2 generated image not shown after building jar-file

In my JavaFX Application I generate a barcode with barcode4j by Apache, save it as png image in the directory /data/images/ and embed it in a web page which is shown on a JavaFX WebView.
After generating the barcode I embend it into the webpage using the following Javascript-Code:
path = "file:/" + path.replace(/\\/gi,"/");
var barcodeElement = document.getElementById("productBarcode");
barcodeElement.setAttribute("src", path );
barcodeElement.style.display = "inline-block";
I use the absolute path C:\path\to\java-program\data\myimage.png and build a file-URL from it.
Using this in Eclipse works without any problems. But when I build my project and start it from my jar-file the image is not shown. But the problem is not, that the path is incorrect or that generating the picture does not work, so that there is some kind of "not found" error. The place where the image should be is just white with a light border around.
And now the strangest part: If you right click on the image and choose "open in new window" the image is shown!
Does someone has an idea about that?
Thank you very much in advance!
My understanding is that the WebView won't let a page loaded with one protocol access files using another one. This makes perfect sense when you load through http://, and forbid file://. Here, you're loading through jar:file:..., and the webview will only let you access jar:file:... resources (I just tried, I can access an image from another jar file, from the same jar file, but not from outside!).
This sounds very much like a bug to me.
One workaround mentioned here is to use "data:" URI (i.e. encode the image directly in the HTML file).

Highlight and Annotate text in AePubReader iPhone SDK

Is there any way to get text position for mark up and make note on ePub file ? I want to put highlight and add note feature on ePub file.
I am referring https://github.com/fedefrappi/AePubReader as a basic start. This code already facilitates searching and font size varying feature.
Please suggest me anyway to achieve my requirement with this library.
Thanks in advance.