1

I'm new into Flutter and I'm trying to add Blockly into Flutter for an app for kids. I want to be able to program some code into a Flutter app with Blockly, practically I'm trying to create a route with inside a Blockly widget in which the kid, through Blockly, can codes some simple programs and these are used by the Flutter app to do something.

1 Answers1

3

If I understood right, you want to use Blockly as a widget inside your app. A way to do that is to create a route that has a WebView widget in order to display Blockly:

 @override
  Widget build(BuildContext context) {
    return WebView(
      initialUrl: 'https://developers.google.com/blockly',
    );
  }
Radu Hrihoreanu
  • 364
  • 3
  • 16
  • Thank you so much! How can I get the response send from Blockly? – Enrico Mosca Dec 02 '20 at 15:42
  • 1
    Well, your app will have to communicate directly with Blockly via http calls. I have not worked with Blockly so much before, you should see if they have an exposed rest API that you can communicate with in order to get your data. – Radu Hrihoreanu Dec 02 '20 at 20:42
  • @RaduHrihoreanu so I want to use blockly in my windows desktop application. can I use webview widget with the above URL to work on? – ᴅ ᴇ ʙ ᴊ ᴇᴇ ᴛ Mar 10 '22 at 10:46
  • @ᴅᴇʙᴊᴇᴇᴛ according with the WebView library documentation: https://pub.dev/packages/webview_flutter this widget is only for Android and iOS platforms is I don't think it will work on a desktop application. You can try this library instead: https://pub.dev/packages/webview_windows . Is a webview library created for web project. Hope it helps :) – Radu Hrihoreanu Mar 10 '22 at 18:03
  • @RaduHrihoreanu Yesterday night I already tried that package but I encounter this new error https://cutt.ly/1AHcgh1 – ᴅ ᴇ ʙ ᴊ ᴇᴇ ᴛ Mar 11 '22 at 03:31