Render SVG and PNG/JPG with the same Widget - flutter

Currently, I am using Image.network to render PNG/JPG and SvgPicture.network to render SVG.
However, is there a Widget that is able to detect the actual image type and automatically selects either Image.network or SvgPicture.network depending on the type?

Related

Display .ico or .icon image in flutter

I have an API providing images with .icon format and I would like to display the image on my Flutter app.
you can use image widget for it like bellow
Image.asset("assets/images/home.ico"),
Image.network(
"https://api.hala-on.com/category_images/icons/1672329105.icon"),
i have write these two widgets of image in actions and see the results one is displaying the .ico image from the assets and the other is displaying the image from the link you provided.
see the results
Code for this

Flutter widget display in custom position

I am making a mobile app in Flutter. I need to display widget in random positions of my choice on the screen e.g. we can define the position of where we want to print or display something when we code in HTML.
I took this image from this link: https://www.invisionapp.com/inside-design/design-resources/free-mobile-ui-kit-atlas/
How can I achieve display a widget in a custom position as shown in the image above?

Flutter box decoration in a container

How can I use svg image in a container's box decoration? Seems it only allows the png/jpg files in AssetImage(). I am trying to display two images on top of the background image set through the box decoration. I am trying to dodge the method of stack. So is there a way?
Flutter has no inbuilt support for SVG as of now..
But you can try this package -> https://pub.dev/packages/flutter_svg
final Widget svg = new SvgPicture.asset(
"assets/image.svg",
);
However, I'd recommend not using an SVG, instead convert your image to a png format

How to open Image in full screen when we press on list of image in flutter?

Here I actually use GridView.builder for load list of images. I want to add functionality like when I click on any particular image, it load and open in full screen. How is the possible in flutter?
It may not be the best way but it does the job for me.
Hero widget for multiple network images
The idea is to assign unique hero tags to your images and create a widget for the next screen which dynamically assigns hero tag with the value passed through the constructor. Instead of changing tags for your images, change the tag for the hero widget on the next screen.

flutter how to get size of widgets before building

I'd like to fit multiple widgets into PageView,
if the page is full, I want to move to the next page.
So I'd like to get sizes of the widgets inside the page without building the widgets.
This post seems that it's required to build the widget first before getting the size.
For text, I can do it using RenderParagraph.
Is it possible to get the size of custom widgets?
The widgets I want to get the size are basically text which we can tab each word.