Share Widget Screenshots with Flutter | Day 09 -
HTML-код
- Опубликовано: 9 сен 2024
- Kilo Loco shows you how to take screenshots of your custom widgets and share them outside of the app. In this tutorial, you will learn how to use both the screenshot and share libraries.
** Show Notes and Links **
Project Files:
github.com/Kil...
Kilo Loco on Social Media:
www.kiloloco.com
Discord - / discord
Twitter - / kilo_loco
Instagram - / kilo_loco
#flutter #dartlang #30DaysOfFlutter
Thank Kilo Loco for the video. For those who are using the new Screenshot package you need to change the _takeScreenshot() function code to this :
void _takeScreenshot() async {
final uint8List = await screenshotController.capture();
String tempPath = (await getTemporaryDirectory()).path;
File file = File('$tempPath/image.png');
await file.writeAsBytes(uint8List);
await Share.shareFiles([file.path]);
}
Thanks bro !
Thank so much bro. You saved my hours
what about getTemporaryDirectory, and image.png, and writeAsBytes, they are all showing errors
Thank you! Life saver.
@@user-nb9kd6yp2j Me too bro, did you find a solution for this?
Breaking change to Screenshot (0.3.0 10/02/2021) . The capture method now returns Uint8List instead of File. If you want to follow along with the video exactly, you'll need fix the reference the previous version of the package, in the pubspec.yml to version 0.2.0 specifically (i.e. remove the ^ )
Thanks for sharing
Hey @Ralph Shillington what is the solution for screenshot ^0.3.0
and for 030?
@@viveks. checkout my comment above if you haven't found any workaround
@@marcelhh5722 checkout my comment above if you haven't found any workaround
Thank you, I am from Uzbekistan
newest solution will be
shareImage() async {
final uint8List = await screenshotController.capture();
String tempPath = (await getTemporaryDirectory()).path;
String fileName =" ";>>>>>your file name between ""
File file = await File('$tempPath/$fileName" }.png').create();
file.writeAsBytesSync(uint8List!);
await Share.shareFiles([file.path]);
}
It's very useful. I had been looking for these kind of stuff since 20 days almost.
I just found your channel and I think it its amazing!!
Haha thanks!! Glad you like it!
Great! Just what I needed 🙏
Awesome! This is really helpful
Thank you. You always help.
Sir, Do i need to have the screen open for taking the screenshot? Or can it be done in background?
Can we directly share screenshot without saving in directory from flutter web ?
Hey there,
Thanks for the video. When I try to share the image along with text on WhatsApp, the image does not get shared. If I try this messenger or any other service it works well. It even works well on android WhatsApp. Can you please provide a solution for this error?
can I use this on flutterflow?
You're amazing 😊💙🙏
Thank you! 🙂
Screenshot is not working with webview widget
How to make it work
Dont work more with 0.3.0 any solution?
if you find a solution, please share
How to add watermark on full screen capture with Flutter
This doesn't work for 0.3.0 version, how to handle saving and sharing SS with the latest version.
See my comment above
@@El-lj5pz Thank so much bro. I hope your comment will be upvoted.
anyone get problem with Screenshot on samsung device ? , it works only first time ,another device works fine
path error, help please
Can we add watermark to screen shot
How can we make an flutter app where one app can login only one device ; if user will add another account it won't sign in the app?
Does it possible to do?
If yes please help me out!
#thankyourforthisawesometutorial #flutter #happycoding #awesometutorial #stayhealthy
This could probably be done by saving a unique value like the user ID to the keychain and checking that before allowing the user to sign it, but i dont think that would be a good user experience. Most big apps allow you to sign in to different accounts from the same device no problem
@@Kilo_Loco i think if one user have only one account in his/her phone that might be safe and less chance of misues!
path error plz ans and give me solution
me too
what the answer
var imageuint = await screenshotController.capture();
var directory = (await getApplicationDocumentsDirectory()).path;
File imgFile = new File('$directory/sfs.png');