Closed shaan-mephobic closed 3 years ago
Excellent Package you got here! So I tried capturing invisible widget but I get this error which I can't fathom.
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: 'package:screenshot/screenshot.dart': Failed assertion: line 92 pos 12: 'logicalSize.aspectRatio == imageSize.aspectRatio': is not true. E/flutter ( 6791): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) E/flutter ( 6791): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5) E/flutter ( 6791): #2 ScreenshotController.captureFromWidget (package:screenshot/screenshot.dart:92:12) E/flutter ( 6791): #3 _BeginState.build.<anonymous closure> (package:Phoenix/src/Begin/begin.dart:243:50) E/flutter ( 6791): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21) E/flutter ( 6791): #5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24) E/flutter ( 6791): #6 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607:11) E/flutter ( 6791): #7 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5) E/flutter ( 6791): #8 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:230:7) E/flutter ( 6791): #9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:475:9) E/flutter ( 6791): #10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:93:12) E/flutter ( 6791): #11 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:138:9) E/flutter ( 6791): #12 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8) E/flutter ( 6791): #13 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:136:18) E/flutter ( 6791): #14 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:122:7) E/flutter ( 6791): #15 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:439:19) E/flutter ( 6791): #16 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22) E/flutter ( 6791): #17 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:287:11) E/flutter ( 6791): #18 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7) E/flutter ( 6791): #19 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5) E/flutter ( 6791): #20 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7) E/flutter ( 6791): #21 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7) E/flutter ( 6791): #22 _rootRunUnary (dart:async/zone.dart:1370:13) E/flutter ( 6791): #23 _CustomZone.runUnary (dart:async/zone.dart:1265:19) E/flutter ( 6791): #24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7) E/flutter ( 6791): #25 _invoke1 (dart:ui/hooks.dart:182:10) E/flutter ( 6791): #26 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7) E/flutter ( 6791): #27 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
I used the same code used in the example
IconButton( icon: Icon(Ionicons.barcode_outline), color: Colors.white, iconSize: deviceWidth / 18, onPressed: () { ScreenshotController screenshotController = ScreenshotController(); screenshotController .captureFromWidget(Container( 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"))) .then((capturedImage) { // Handle captured image }); });
Would you please help me out here?
Edit: Turns out this only happens in debug mode and works fine in release. I don't know whether this is an intended behavior or not. If it is intended, then feel free to close this issue.
I'm also having this exact same behaviour
Resolved in version 1.2.2
Excellent Package you got here! So I tried capturing invisible widget but I get this error which I can't fathom.
I used the same code used in the example
Would you please help me out here?
Edit: Turns out this only happens in debug mode and works fine in release. I don't know whether this is an intended behavior or not. If it is intended, then feel free to close this issue.