captureFromWidget method
Future<Uint8List?>
captureFromWidget(
- Widget widget, {
- required ImageInfos imageInfos,
- BuildContext? context,
- Size? targetSize,
- dynamic onImageCaptured()?,
- bool stateHistroyScreenshot = false,
- String? id,
Value for delay
should increase with widget tree size. Prefered value is 1 seconds
context
parameter is used to Inherit App Theme and MediaQuery data.
This function is inspired from the package screenshot
from the autor SachinGanesh.
https://pub.dev/packages/screenshot
Implementation
Future<Uint8List?> captureFromWidget(
Widget widget, {
required ImageInfos imageInfos,
BuildContext? context,
Size? targetSize,
Function(ui.Image?)? onImageCaptured,
bool stateHistroyScreenshot = false,
String? id,
}) async {
ui.Image image = await _widgetToUiImage(
widget,
context: context,
targetSize: targetSize,
);
return _capture(
image: image,
imageInfos: imageInfos,
id: id,
onImageCaptured: onImageCaptured,
stateHistroyScreenshot: stateHistroyScreenshot,
);
}