Flutter web svg image will not be displayed after Firebase hosting - flutter-web

Svg images do not appear after hosting. Consolos scan shows that svg files are downloaded. But it doesn't appear. Can anyone help me with this?
I have already built the web app in both html and canvaskit, but it doesn't work in either. I can only see the svg images on localhost.
I use the https://pub.dev/packages/flutter_svg package.
I use a Firebase hosting service.
enter image description here => localhost
enter image description here => hosting

In my case I needed to put the full path name (i.e. include 'assets/'):
SvgPicture.asset('assets/path/to/file.svg')

I found a solution to diplay the current svg/png correctly after Firebase Deploy.
There's something wrong with flutter after we run flutter build web. The respective assets, should be moved into /web directory (on build folder you can check items before do the deploy). But, they are not moved in.
So, in my case, I've removed all assets (png's or svg's) from the root project /assets and set them into the /web/assets folder (mannually)!
This is the automatic process that flutter do after you run flutter build web.
Just pay attention with the declaration of the assets in the pubspec.yaml file. The files must be matching the path for the web folder.
Example:
pubspec.yaml
assets:
- assets/
using the svg icon (without the /assets):
myIcon.svg
Try it. It should work.

Related

Is folder canvaskit part of the output of the flutter web?

When outputting the flutter_web, the canvaskit enter image description herefolder is sometimes created and sometimes not, is this folder also a product? What does this folder do? And why is it so large?
Flutter uses skia or canvaskit as a default rendering option for rendering web app you can use the HTML rendered instead of the canvaskit but that would affect your webapp quality.
You can remove it from the file but in that case your webapp use the canvaskit from internet either way the canvaskit must somehow used inorder to display your web app and the if you want to save up some space and make your app get the canvaskit from external source you can remove it

I'm using tailwindCSS for a simple html site but deployment on netlify does not work, why?

I've been learning how to use tailwind css by following the offical video tutorial and I just wanted to try to deploy the site example to Netlify to see if it works using the drag and drop feature.
This means taking the entire project folder and dumping it into netlify. This usually works with vanilla html css js sites but for some reason I get the error
Page Not Found Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
This is how the project structured looked like:
What am I doing wrong? Inside the build folder there is another file called tailwind.css
On your Netlify dashboard, change the publish directory to the directory where your index.html file resides: public/. That should do it.
You can also, as you said, take everything out of the public folder and put it at the same level as the other folder and files, which makes the index.html available at the root of the project. However, then you lose your project's file organization.
I've fixed the problem.
The trick was to take everything out of the public folder and put it at the same level as the other folder and files.
This would make the index.html file available at the root of the project and would allow the site to work properly once deployed.

How to configure the server in angular to get files?

I just run the ng serve command and go to the server. But if I drop the file house.jpg into the src folder, then when I access the address http://localhost:4200/house.jpg then I don’t see this file, the main page of the project opens.
I did not find anything about it in the official documentation, I ask the help of professionals
You need to follow the Angular Structure Guide. As said above, you need to put your images and other files you want to use frontend-side in the assets folder.
The assets folder contains image and other asset files to be copied as-is when you build your application.
Notice you can create any folders you want in assets if you want to order your files.

Why Would React Change Image File Extension On Build

I am using create react app and have an image tag that was inadvertently capitalized (tony.JPG). I did a build and successfully pushed the app to production on Heroku. However, I realized the capitalization issue and change the extension to its proper lower case (tony.jpg). However, the build file still showed with the capitalized extension. I deleted the build file and did a new build but got the same issue again. I resolved the issue by changing the img tag src but I have a lingering question. Why would react keep capitalizing the image extension even though the image file was changed to lower case and there was a new build?
I am using Node, Express, & Create React App. I've tried changed the file path in explorer directly and in my client > public > images > tony.JPG. It may be related but the build > images folder not only has the capitalized extension but has two other files (one that is tony.JPG~e5463541ef50286886de13e03dea670ef69c85c6 and another file called tony.JPG~HEAD).
Images name in public folder (tony.jpg):
Image in build folder (tony.JPG):
As #Matt-holland mentioned the type of OS matters, OSX is type insensitive if you're using it
If you run git mv tony.JPG tony.jpg it will rename it in git
So the issue was resolved when I did a hard reset on my PC. I am using Windows 10. I believe the issue is a bug as the issue resolved itself (i.e. the file name changed) after I ended up doing a hard reset on the PC. It could be an issue with my machine and/or VS. Hopefully this will help someone else that comes across the same issue.

MonoDevelop's Images directory does not seen on XCode(IB)

In my project files marshalling shown below ,Mono Develop doesn't show Images directory(group) in XCode and they are not seen on xib interfaces,also crashes on runtime. But when I put images under Project's root directory works fine!
Fine! But seeing dozens of images on root directory make things confusing.
Here goes details;
My images built actions are content.
I have tried adding them to Xcode by creating a group named Images then this time all images copied to Mono Develop's root again.
Am I missing something?
Project
--Images
---- FaceOff.Png
---- icons
---------CandyButton32x.png
I think you are experiencing a limitation of the XCode integration with MonoDevelop.
Images only show up in XCode if they are in the root directory of your project. To combat this, there are two ways you can setup your image folders for MonoTouch projects:
Use build action Content, put your images anywhere, but they will only show up in XCode if they are in the root of the project
Use the build action BundleResource and put all your images in the Resources folder, this is the same as putting your images in the root of the project, but you get to package them nicely in a subfolder
I have not experimented with BundleResource and XCode to see if subfolders work via that method or not.
This is from my experience, someone from Xamarin, feel free to chime in.
Further to Jonathan's great answer, I have a nice organised setup for my images using BundleResource and the Resources Folder.
On the filesystem I have all my images in a nice directory structure, for example: img/common/title.png.
I then add all the image files (not directories) into the iOS project Resources folder, using the 'Add Files' option and selecting BundleResource for the files I select.
When given the copy, move or link option, because my files are outside the target directory, I select the 'Add a link to the file' option.
This procedure allows me to:
Happily keep all my images in an organised directory structure on the file system
Have access to them in XCode Interface Builder
Access them as root when in code, such as Image.FromFile("title.png")
Easily update them in the filesystem and have them automatically change in Xamarin Studio

Resources