Show Scale image as widget in flutter - flutter

I can show Image from Network url in flutter.
FadeInImage.assetNetwork(
placeholder: Assets.GENRE,
image: item.image, fit: BoxFit.cover,
)
Now, I want :
After got Image url from API,
I'm able to Scale that image and show on UI as Widget.
I found ImageInfo had attribute is scale
But I didn't get any example details how to apply this.
People who know,
Please give me an example,
Thank you,

You can use Image.Network as it's having scale and BoxFit both options. check out Image.Network here.
Example:
FadeInImage(
placeholder: Assets.GENRE,
image: Image.Network(url,scale:2.0,fit:BoxFit.cover,repeat:ImageRepeat.noRepeat),
)

Related

Flutter - How implement a file, image and camera picker for local storage

Hi, I would like to implement something like this in flutter. A button from which I can upload local photos from the camera or from images and files in the device to the app. Once I have taken the file I want it to appear near the button with the preview of the file as shown in the example and with the possibility of removing them. What's the best way to do this? Is there a package that does these things?
Thanks in advance!
Yes, there is! The package is image_picker.
To install it, add it as a dependency to your pubspec.yaml or run flutter pub add image_picker.
dependencies:
image_picker: ^0.8.5
Here's an example of how I've used it in my recent app:
final XFile? pickedFile = await ImagePicker().pickImage(source:
ImageSource.gallery); //This opens the gallery and lets the user pick the image
if (pickedFile == null) return; //Checks if the user did actually pick something
final File image = (File(pickedFile.path)); //This is the image the user picked
Once you've got the image, you could use a container to show it.
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: Image.file(image),
),
),
)

I want a image but nither assest image nor network image is loading on screen

image is not loading in output in my screen .soo plz anyone help me in solving this
Container(
decoration: const BoxDecoration(
image:DecorationImage(image: NetworkImage(''))
),
)
Check if you added your image into the pubspec.yaml file like this:
assets:
- images/image1.jpeg
- images/icon.png
I suggest use the child of the Container and not the decoration.
Also, you could use Image.Asset instead, specifing height or/and height:
Image.asset('images/icon.png', height: 20)
Documentation here and here
Generally, Network Images on flutter take time to appear.
But if it still continues then
Check Internet Permission setting in andoidmanifes.xml file
Using Asset image is not a good solution because it makes the app size larger..
The solution is that you need to use:
Container(
child: Image.network('') //your image source
)
And if that is not the case.. the image you are using is invalid but not exactly invalid. Meaning it does not end with an image format in the end.. like (.jpg,.png etc.)

How to place image Placeholder using Image.network() in flutter?

I want a fade in image with a placeholder. After searching through internet I came across FadeInImage.memoryNetwork() and it is working fine as I wanted, but now I also need to call a function when the image is loaded successfully from network, thanks to Image.network() for providing loadingBuilder() function.
But the problem is that I am not able to use both FadeInImage.network() as well as Image.network() simultaneously and I want both the property for my app.
Any suggestions how to put image placeholder using Image.network or other way round how to use loadingBuilder in FadeInImage.memoryNetwork(). Any way round will solve my problem.
Any suggestions is highly appreciated.
you can try this:
var image = Image.network(//your code);
FadeInImage(
placeholder: //your placeholder
image: image.image,
)

How can I display image from get request on screen in flutter?

I am new to flutter. I am facing issues in displaying image on the screen that I am getting from MongoDB. The image I am getting is in the format "somenameofimage.jpg" or "somenameofimage.png".
I have searched for it, but every I see NetworkImage used for loading images from internet I guess or from assets.
I am getting the result of get request in a variable that has other details like name contact etc as well.
i use this to get image from server
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: profileData.imageAddress != null
? NetworkImage(
profileData.imageAddress)
NetworkImage works fine for me... look at the URL for the picture put it in your browser to see if it is correct or not
this works too
Image.network(profileData.imageAddress,)

Flutter using basic flr and play in project

From this link i downloaded basic flr binary file and i would like to use and animate that in flutter.
after downloading that and put in assets folder and define in pubspec.yml, that can ba show on application but, it doesn't has any animation
return FlareActor(
"assets/flr/liquid_loader.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: "go", //<--- how can i play or put some option here?
);
The name of the animation is the same as the one you created in two dimensions. Example: This image animation has the name idle, so you would have to put animation: "idle" or the name of the other animations that are just below.