kherel/animated_theme_switcher

Web support

joshbenaron opened this issue · 3 comments

Hey,
Thanks for the great package!
I was wondering whether you were looking to support web? I don't think it would too difficult although I'm not sure what blockers there would be.

Hi @joshbenaron ,
After closed issue flutter/flutter#42767 and merged pr flutter/engine#22085 this plugin can work in web but just in CanvasKit mode.
By default, Flutter’s web support uses DomCanvas as said in link and DomCanvas can't take screenshot but you can enable the CanvasKit rendering engine with this command --dart-define=FLUTTER_WEB_USE_SKIA=true.

For more info about DomCanvas and CanvasKit please read https://medium.com/flutter/flutter-web-support-updates-8b14bfe6a908

Tested using Flutter 2.0.0. Works on web.

@vodemn its just work on canvaskit, in version 2.0.0 web renderer is set to auto so its use canvaskit on desktop browsers and html on mobile browsers that this plugin not works.

To optimize your Flutter web app for the characteristics of each device, the rendering mode is set by default to auto. This means that your app runs with the HTML renderer on mobile browsers and with CanvasKit on desktop browsers.

ref link

so this plugin just work on web in all platforms when you set canvaskit explicitly with:

--web-renderer canvaskit

i write a note in readme for users to support web.