Davinci


A package to convert any widget to an image which can be used to share to other apps and chats.
📹 Preview

ℹ️ Usage
Imports
import 'package:davinci/core/davinci_capture.dart';
import 'package:davinci/davinci.dart';
Pseudo code
If the widget is in the widget tree Use click method |
If the widget is not in the widget tree Use offStage method |
---|---|
![]() |
![]() |
By default the generated image name will be "davinci". But if you wish to change it, you can pass the image name in DavinciCapture.click method.
await DavinciCapture.click(imageKey, fileName: "Hello");
When the image is captured, you can either open the image preview or get the image in Uint8List.
await DavinciCapture.click(imageKey, fileName: "Hello", openFilePreview = false, returnImageUint8List = true);
If the captured image is pixelated, calculate the pixel ratio dynamically based on the device and pass it to the DavinciCapture.click method.
double pixelRatio = MediaQuery.of(context).devicePixelRatio;
await DavinciCapture.click(imageKey, fileName: "Hello", pixelRatio: pixelRatio);
ℹ️ All the parameters in the click
method is present in offStage
method too.
🛎️ Note :
- Cannot capture Platformview due to issue https://github.com/flutter/flutter/issues/25306
- The Generated image can be shared to other apps and chats but it is stored temporary storage on the device, which you can NOT access in iOS. If you wish to save it locally, you can save it from the preview page. But do remeber to add necessary permissions in
info.plist
andAndroidManifest.xml
. For more info: https://pub.dev/packages/image_gallery_saver