screenshot icon indicating copy to clipboard operation
screenshot copied to clipboard

Invalid image dimensions

Open ranahyder87 opened this issue 3 years ago • 8 comments

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Exception: Invalid image dimensions.
E/flutter (10185): #0      ScreenshotController.capture.<anonymous closure> (package:screenshot/screenshot.dart:58:9)

I used Transform and Positioned in Stack. Using this a corner of an image goes outside.

ranahyder87 avatar Jul 29 '21 20:07 ranahyder87

Looks like the image corner is not an issue, this exception comes on and off.

ranahyder87 avatar Jul 29 '21 20:07 ranahyder87

I'm getting this error every execution with example code. Running from a background task. E/BackgroundWorker(20720): errorCode: error, errorMessage: Exception: Invalid image dimensions.

ScreenshotController screenshotController = ScreenshotController();
await screenshotController.captureFromWidget(
  Container(
      height: 200,
      width: 200,
      padding: const EdgeInsets.all(30.0),
      decoration: BoxDecoration(
        border: Border.all(color: Colors.blueAccent, width: 5.0),
        color: Colors.redAccent,
      ),
      child: Text("This is an invisible widget")
  ),
  pixelRatio: 1.0,
).then((Uint8List image) async {
  if (image != null) {
    final imagePath = await File('$directory/$filename').create();
    await imagePath.writeAsBytes(image);
    print('BACKGROUND: img saved.');
  }
});

whlla avatar Sep 08 '21 07:09 whlla

I have the same issue.

CoderJava avatar Oct 26 '21 08:10 CoderJava

I am facing the same issue, too. No updates yet?

Tukhtamurodov-Sardorbek avatar Dec 07 '22 09:12 Tukhtamurodov-Sardorbek

same

feduke-nukem avatar Dec 11 '22 15:12 feduke-nukem

you can try increase delay time

learning233 avatar Dec 13 '23 06:12 learning233

any update on this issue

Appsketiers avatar Mar 12 '24 16:03 Appsketiers

Same here on latest version

dirol90 avatar Mar 15 '24 23:03 dirol90