I tried using the https://pub.dartlang.org/packages/share plugin to share an image on my flutter app to other app like Whatsapp, Facebook and so on. But rather it sending the file name of the image(images/female/ankara/ank5.jpg) in my android project to the other application rather than the actually image.
How can make it send the actual image.
Hero(
tag: widget.imageList,
child: PhotoView(
imageProvider: AssetImage(widget.imageList),
)
);
final RenderBox box = context.findRenderObject();
Share.share(widget.imageList,
sharePositionOrigin:
box.localToGlobal(Offset.zero) &
box.size);
I excepted to send the actual image to the other app rather it in a string format.
As mentioned in the previous comment, you can follow the answer on this Stack Overflow post for sharing images from a Flutter app. As for selecting a different image, you can use storage path provider plugins like ext_storage or image_picker.
Related
I am using image_picker plugin to pick images and videos but in the plugin example you must select that you want to pick image or video from gallery . So is there is another way to show both together in one place ?
final ImagePicker _picker = ImagePicker();
// Pick an image
final XFile? image = await _picker.pickImage(source:
ImageSource.gallery);
// Pick a video
final XFile? image = await _picker.pickVideo(source:
ImageSource.gallery);
You are dependent on the plugin and its capabilities that you use. If it does not provide what you need, either you need to develop your plugin or try to use another one. If this plugin is changeable for you, please take a look following solutions:
1- wechat_assets_picker:
final List<AssetEntity>? assets = await AssetPicker.pickAssets(
context,
maxAssets: 2,
requestType: RequestType.all,
pickerTheme: appTheme,
textDelegate: EnglishTextDelegate(),
);
It provides different RequestType like audio, video, common, image, and all.
2- photo_manager:
final assetPathEntityList =
await PhotoManager.getAssetPathList(type: RequestType.all);
This plugin provides different RequestType like audio, video, common, image, and all too. The difference is there is no UI widget. Therefore you need to develop your UI and connect with this plugin.
If you have further questions, please don't hesitate to write in the comments.
You can do one thing, If you need to use image_picker then you can do following,
Give pin icon widget where you want to access media.
Show dialog on it which says, either select video or image.
Handle your methods accordingly.
I'm trying to pick multiple images at once using the image_picker 0.7.5+3 package
so my code is simple , just one line to open the gallery to select from it
final images = await ImagePicker.platform.pickMultiImage();
but it's showing this error
enter image description here
i tried running flutter clean and deleting the app from emulator and retarting everything but it's the same problem,
note : using final images = await ImagePicker().getImage(source: ImageSource.gallery); it allows me to choose an image without any problems
final result = await ImagePicker().pickMultiImage(
imageQuality: 70,
maxWidth: 1440,
);
This should work as usual. If you are testing on android emulator and the default file manager, you have to long press the first image to multi-select.
Try a long click on one image, then it will let you pick multiple images.
I can't find anything in their API reference for pickMultiImage. I don't think it exists, unfortunately. There's a package called images_picker, maybe that helps you.
Is it possible to use drawable resources bundled in your app instead of hosted images for adding stickers to Gboard?
Google provides the following code snippet here to show how to add a sticker to Gboard and it looks like the only way is to reference a hosted image:
new Indexable.Builder("Sticker")
.setName("Bye")
// add url for sticker asset
.setImage("http://www.snoopysticker.com?id=1234")
// see: Support links to your app content section
.setUrl("http://sticker/canonical/image/bye")
// Set the accessibility label for the sticker.
.setDescription("A sticker for Bye")
// Add search keywords.
.put("keywords", "bye", "snoopy", "see ya", "good bye")
.put("isPartOf",
new Indexable.Builder("StickerPack")
.setName("Snoopy Pack")
.build())
.build())};
All help is greatly appreciated!
String drawableResourceUri = Uri.parse("android.resource://your.package.name/drawable/yourfilenamewithoutextension").toString());
Add this string to your setUrl() method.
Google's AppIndexing sample project has an example of the files being generated at run time. This isn't exactly a Drawable resource but the same strategy can likely be used.
I am developing on android. My react-native version is 0.42. I'm using react-native-share package for sharing screen view. The data I want to share is being converted to base64.
...
const uri = "data:image/jpeg;base64,...";
Share.open({
title: "Title",
message: "Message",
url: uri,
subject: "Mail subject"
})
...
This process was working properly on whatsapp, facebook and email before.
However, now, when I tried on whatsapp the response is 'Sharing failed. Please try again', on facebook I'm getting an empty text area without sharing options and on email I'm getting the text typed options except for the image.
Do you have any suggestion? Thank you.
I am using react-native-share but using the shareSingle option like this:
Share.shareSingle({
message:'I just added a new outfit to my album.',
url:Constants.image64, //base64 image
social: "whatsapp"
});
It works great on both the platforms. You can try it if it suffice your needs.
I'm developing a EBookreading application, EBookDroid is a library which we are using for the PDF reading. If we have any links in the PDF like www.stackoverflow.com, when the user clicks on it, it supposed to open the link, for that i need to find out the coordinates of that link in the Document.
I am writing like the below.
final RectF linkRect = page.getLinkSourceRect(pageBounds, link);
But it's always giving the null back.
Try this may be use full
THIS EXAMPLE