davinci 2.0.3 copy "davinci: ^2.0.3" to clipboard
davinci: ^2.0.3 copied to clipboard

outdated

A package to convert any widget to an image which can be saved locally or can be shared to other apps and chats.

Davinci Pub version Codacy Badge #


A package to convert any widget to an image which can be saved locally or can be shared to other apps and chats.

📹 Preview #

ℹ️ Usage #

Prerequisites

on iOS

Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

  • NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.

on Android

  • android.permission.WRITE_EXTERNAL_STORAGE - Permission for usage of external storage

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

To save the image directly to the device, set saveToDevice flag to true. You can also specify the album name or you can leave it undefined.

await DavinciCapture.click(imageKey, fileName: "Hello", saveToDevice = true, album: "Davinci", openFilePreview = false);

ℹ️ All the parameters in the click method is present in offStage method too.

🛎️ Note : #

169
likes
0
pub points
89%
popularity

Publisher

verified publishergokula.dev

A package to convert any widget to an image which can be saved locally or can be shared to other apps and chats.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, gallery_saver, open_file, path_provider

More

Packages that depend on davinci