Closed bartonhammond closed 3 years ago
@bartonhammond I am not able to find the documentation for --web-renderer=html
. Could you provide a link to the docs? I guess this flag contradicts canvaskit usage.
I don't know about any docs - I found the option here.
Line 146 in above code, sets FLUTTER_WEB_USE_SKIA
to false
. Why do you need this flag?
I'm using easy_web_view
package to show my landing page which is written
in html. W/o the web-renderer
, the page can't be scrolled or interacted
with - the links, for example, don't work. So with this web-renderer
set
to html, the embedded landing page works correctly but then I can't crop
pictures later. If there was a way to toggle that switch that would be
great.
On Fri, Dec 4, 2020 at 10:18 AM Mahdi notifications@github.com wrote:
Line 146 in above code, sets FLUTTER_WEB_USE_SKIA to false. Why do you need this flag?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xclud/flutter_crop/issues/46#issuecomment-738873899, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJZCPES3GSUYQRF3L25BL3STEDWTANCNFSM4UNSDODQ .
I will try to find a work around this problem. Meantime, can you provide some code for testing? attaching here or a repo link is good.
Ok. Also, if you flutter run --help
includes:
--web-renderer The renderer
implementation to use when
building for the web.
Possible values are:
html - always use the HTML
renderer. This renderer
uses a combination of
HTML, CSS, SVG, 2D Canvas,
and WebGL. This is the
default.
canvaskit - always use the
CanvasKit renderer. This
renderer uses WebGL and
WebAssembly to render
graphics.
auto - use the HTML
renderer on mobile
devices, and CanvasKit on
desktop devices.
[auto, canvaskit, html
(default)]
Here's a repo w/ both flutter_crop
and easy_web_view
. See the README for instructions
https://github.com/bartonhammond/crop_easy_web_view
Thanks!
I am getting the same error, on flutter web. Here is the error log -
Uncaught (in promise) Error: Unsupported operation: toImage is not supported on the Web at Object.throw_ [as throw] (errors.dart:216) at _engine.SurfaceScene.new.toImage (scene.dart:20) at layer$.OffsetLayer.new.toImage (layer.dart:1206) at toImage.next (
) at runBody (async_patch.dart:84) at Object._async [as async] (async_patch.dart:123) at layer$.OffsetLayer.new.toImage (layer.dart:1190) at proxy_box.RenderRepaintBoundary.new.toImage (proxy_box.dart:3093) at ui$._CropState.new.[_crop] (ui.dart:80) at ui$.CropController.new.crop (ui.dart:409) at new_image_cropper._OBImageCropperState.new._cropImage (new_image_cropper.dart:43) at _cropImage.next ( ) at runBody (async_patch.dart:84) at Object._async [as async] (async_patch.dart:123) at new_image_cropper._OBImageCropperState.new.[_cropImage] (new_image_cropper.dart:39) at ink_well._InkResponseState.new.[_handleTap] (ink_well.dart:990) at tap.TapGestureRecognizer.new.invokeCallback (recognizer.dart:183) at tap.TapGestureRecognizer.new.handleTapUp (tap.dart:598) at tap.TapGestureRecognizer.new.[_checkUp] (tap.dart:287) at tap.TapGestureRecognizer.new.acceptGesture (tap.dart:259) at arena.GestureArenaManager.new.sweep (arena.dart:157) at binding$5.WidgetsFlutterBinding.new.handleEvent (binding.dart:385) at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:361) at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:279) at binding$5.WidgetsFlutterBinding.new.[_handlePointerEventImmediately] (binding.dart:316) at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (binding.dart:280) at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (binding.dart:238) at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (binding.dart:221) at _rootRunUnary (zone.dart:1202) at async._CustomZone.new.runUnary (zone.dart:1097) at async._CustomZone.new.runUnaryGuarded (zone.dart:1002) at Object.invoke1 (platform_dispatcher.dart:913) at _engine.EnginePlatformDispatcher..invokeOnPointerDataPacket (platform_dispatcher.dart:170) at _engine.PointerBinding..[_onPointerData] (pointer_binding.dart:128) at pointer_binding.dart:525 at pointer_binding.dart:486 at pointer_binding.dart:208
My code is mostly same as the one in example, except the _cropImage function -
void _cropImage() async {
final pixelRatio = MediaQuery.of(context) .devicePixelRatio;
final ui.Image croppedImage = await controller.crop(pixelRatio: pixelRatio);
ByteData data = await croppedImage.toByteData();
final buffer = data.buffer;
Uint8List imgList = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
cropped = PlatformFile(bytes: imgList, name: widget.name);
Navigator.pop(context, {'croppedImage': cropped});
}
@alsiPanda
See #51.
I am using
--dart-define=FLUTTER_WEB_USE_SKIA=true,
on the Master channel and Crop works fine. But due to another requirement, I have to add the flag--web-renderer=html
. With that additional flag, Crop fails.Would you have any idea of a work around?
Here's my launch.json configuration
Here's the stack
Here's doctor: