How to download image in flutter which comes through APIs? - flutter

Here I want to download image which comes through APIs in Flutter. I set edit image functionality and download that edited image. I mean I want to download image with set different widgets on image.
How to accomplish this in flutter?

You can use a Network image to display image Urls that are returned from an API:
const Image(
image: NetworkImage('YOUR IMAGE URL HERE'),
)

You can check;
https://pub.dev/packages/flutter_downloader
Shortly:
final taskImage = await FlutterDownloader.enqueue(
url: 'your url',
savedDir: 'download path',
showNotification: true, // Show download progress
openFileFromNotification: true, // Click on notification to open file
);

Related

Url launcher does not open with appbar

what i want is to get the top bar when I launch URL inappwebview, where it shows Done Mobile.twitter.com aA and refresh icon
So I've tried
await launchUrl(
Uri.parse(url),
mode: LaunchMode.inAppWebView,
);
as well as downgraded url_launcher and tried this
launch(url,
forceWebView: true, forceSafariVC: true, enableJavaScript: true);
None seem to work,
I keep getting the website without the appbar with Done, refresh on top of it
I encountered the same problem when upgrading from using the deprecated launch(url) method to launchUrl(uri).
All it needs is to pass the LaunchMode as below.
launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication )

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),
),
),
)

How can I open read-only webpage on Flutter App

Can you show me the right way to solve my problem?
I want to run a webpage in the application and disable the screen response to user actions. (read only)
I run the page using the code:
String _url = 'https://google.com
await launch(
_url,
enableJavaScript: true,
forceWebView: true,
forceSafariVC: true,
)
But I can't cope with making this page insensitive to user actions (buttons, zooming, etc.). I've tried:
Enable "launch" in ignoring or absorbing. Did not work.
I tried to run a URL as a background and then put an inactive transparent button on it. I failed to.
I have no idea how to bite it.
use webview_flutter instead it gives you more control over the web screen

Ionic Capacitor: How to restrict Gallery from Camera options?

for an app that I'm building, I'm using Capacitor's Camera plugin. When I click the button that launches the camera, it's asking me to first choose between Gallery and Camera.
I'd like to turn the "Pick from Gallery" feature off.
Is there any solution for this?
By default the Camera plugin prompts, but you can select Camera or Gallery by passing the source attribute
// The source to get the photo from. By default this prompts the user to select either the photo album or take a photo. Default: CameraSource.Prompt
source ?: CameraSource;
Full example:
const image = await Camera.getPhoto({
quality: 90,
resultType: CameraResultType.Uri,
source: CameraSource.Camera
});

Redirect to view in other image folders using ImagePicker plugin in android (Ionic 3)

I am using the image picker plugin in my Ionic app. I want able to pick images from other folders from the gallery in android device. For Ios it is possible but for android I am getting this view.
But I want user able to go to other folders and select images from it. Any help would be great.
I supose you are using cordova plugin File. If you want select others routes, u can use the diferents directories provided by File. EJ:
this.file.applicationStorageDirectory
this.file.applicationDirectory
this.file.documentsDirectory
You have the complete list here https://github.com/apache/cordova-plugin-file
If you need more help, say to me.
to use if With Filepicker use a constant to set options:
const options = {
title: 'Select Avatar',
customButtons: [{ name: 'fb', title: 'Choose Photo from Facebook' }],
storageOptions: {
skipBackup: true,
path: 'images',
},
};
and send it to the picker:
ImagePicker.showImagePicker(options, (response) => {